Compare commits
58 Commits
b5112ab12e
...
main
Author | SHA1 | Date | |
---|---|---|---|
574f670ee0 | |||
073c167746 | |||
bca4f2639b | |||
f7ca614b38 | |||
ca02db7b28 | |||
da63fe3b3c | |||
138b3859aa | |||
f9238eef72 | |||
e7fe409ae5 | |||
a424a4e6e5 | |||
aeddfbd339 | |||
5b6b06e70d | |||
33287c4b40 | |||
923d76c085 | |||
5e107d36ca | |||
19a10e5704 | |||
b9307c2f5a | |||
c7b3072e59 | |||
b0c576bad3 | |||
30375476cc | |||
943e8dc273 | |||
2b5e1cf9b9 | |||
050aff5f69 | |||
92af6f6cd7 | |||
c1d83d5536 | |||
492d5a0028 | |||
837b371d9c | |||
b63b849218 | |||
3782ef7282 | |||
a69d83bc0a | |||
a66f2d2422 | |||
e9740e86b5 | |||
5e766bc2e5 | |||
abc3a2a0a0 | |||
c85d93e06f | |||
3fcd0f2c2b | |||
caa2bc6493 | |||
49f1ebc5ba | |||
d2c74a158a | |||
bee1f6c96c | |||
96e084e353 | |||
c7ba74d7e3 | |||
76ecb7d978 | |||
5492bda6d2 | |||
dd6af287f3 | |||
9835f32dfa | |||
b3b58ce103 | |||
4d479cedaf | |||
e204c8a53e | |||
d1eece5875 | |||
9d6c90e9cd | |||
6dafa7f1ee | |||
40a3b93d4b | |||
18820c7191 | |||
bb741539f6 | |||
80fb6cd452 | |||
69322d64f3 | |||
ba736ef661 |
27
.deployment/create_info_json.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if (!isset($argv[1])) {
|
||||
die('No version set, please use ' . PHP_EOL .'make deploy version=' . PHP_EOL);
|
||||
}
|
||||
$file = file_get_contents(dirname(__FILE__) . '/info.json.tpl');
|
||||
$file = str_replace('%version%', $argv[1], $file);
|
||||
$file = str_replace('%date%', date('d.m.Y H:i:00'), $file);
|
||||
$file = str_replace('%changelog%', parseChangeLog(), $file);
|
||||
|
||||
$ptr = fopen('info.json', 'w');
|
||||
fwrite($ptr, $file);
|
||||
fclose($ptr);
|
||||
|
||||
|
||||
system('lftp -e "put -O / info.json; bye" -u "lv-sachsen-main_ftp3,sE&xDXc8za#S" bdp.mein-verein.online');
|
||||
function parseChangeLog()
|
||||
{
|
||||
$return = '';
|
||||
foreach (file(dirname(__FILE__) . '/../changelog') as $line) {
|
||||
$line = trim($line);
|
||||
if ($line !== '') {
|
||||
$return .= $line;
|
||||
}
|
||||
};
|
||||
|
||||
return $return;
|
||||
}
|
17
.deployment/info.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "BdP Kompass",
|
||||
"slug": "bdp-kompass",
|
||||
"author": "Thomas Günther",
|
||||
"author_profile": "https://sachsen.pfadfinden.de",
|
||||
"version": "4.3.2",
|
||||
"download_url": "http://lv-sachsen-main.bdp.mein-verein.online/wordpress/bdp-kompass-4.3.2.zip",
|
||||
"requires": "6.0",
|
||||
"tested": "6.7",
|
||||
"requires_php": "8.2",
|
||||
"last_updated": "02.03.2024 16:24:00",
|
||||
"sections": {
|
||||
"description": "Wordpress-Plugin zur Unterstützung von Stämmen im Bund der Pfadfinderinnen und Pfadfinder e.V. zur optimalen Verwaltung eurer Webseite",
|
||||
"installation": "Bitte wendet euch an den LB IT, falls ihr zur Installation oder zu Updates Fragen habt.",
|
||||
"changelog": "<h4>Version 4.3.1</h4><ul><li>Mehrsprachrigkeit unterstütz</li><li>Unterstützung für Smartphones</li></ul><h4>Version 4.2.1</h4><ul><li>Erweiterte Sicherheitsfunktionen implemntiert</li><li>Passwort-Policies implementiert</li><li>Integration von Limit Login Attempts (classic)</li><li>Integration von WPS Hide Login</li></ul><h4>Version 4.1.1</h4><ul><li>Erster release des Plugins</li></ul>"
|
||||
}
|
||||
}
|
17
.deployment/info.json.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "BdP Kompass",
|
||||
"slug": "bdp-kompass",
|
||||
"author": "Thomas Günther",
|
||||
"author_profile": "https://sachsen.pfadfinden.de",
|
||||
"version": "%version%",
|
||||
"download_url": "http://lv-sachsen-main.bdp.mein-verein.online/wordpress/bdp-kompass-%version%.zip",
|
||||
"requires": "6.0",
|
||||
"tested": "6.7",
|
||||
"requires_php": "8.2",
|
||||
"last_updated": "%date%",
|
||||
"sections": {
|
||||
"description": "Wordpress-Plugin zur Unterstützung von Stämmen im Bund der Pfadfinderinnen und Pfadfinder e.V. zur optimalen Verwaltung eurer Webseite",
|
||||
"installation": "Bitte wendet euch an den LB IT, falls ihr zur Installation oder zu Updates Fragen habt.",
|
||||
"changelog": "%changelog%"
|
||||
}
|
||||
}
|
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
translate: bdp-kompass.php
|
||||
msgfmt lang/bdp-kompass_de_DE.po -olang/bdp-kompass-de_DE.mo
|
||||
|
||||
deploy: bdp-kompass.php
|
||||
make translate
|
||||
@php ./.deployment/create_info_json.php $(version)
|
||||
mkdir -p ./.deployment/bdp-kompass/bdp-kompass
|
||||
cp -r * ./.deployment/bdp-kompass/bdp-kompass
|
||||
rm ./.deployment/bdp-kompass/bdp-kompass/changelog
|
||||
rm ./.deployment/bdp-kompass/bdp-kompass/Makefile
|
||||
rm -rf ./.deployment/bdp-kompass/bdp-kompass/.deployment
|
||||
rm -rf ./.deployment/bdp-kompass/bdp-kompass/.git
|
||||
cd ./.deployment/bdp-kompass/ && zip -qr ./bdp-kompass-$(version).zip ./bdp-kompass/
|
||||
lftp -e "put -O / ./.deployment/bdp-kompass/bdp-kompass-$(version).zip; bye" -u "lv-sachsen-main_ftp3,sE&xDXc8za#S" bdp.mein-verein.online
|
||||
rm -rf ./.deployment/bdp-kompass/
|
||||
rm -rf ./.deployment/info.json/
|
||||
rm -rf ./info.json
|
26
assets/ajax.js
Normal file
@ -0,0 +1,26 @@
|
||||
function kompass_generate_ajax_url(module, ajaxmethode, params) {
|
||||
return ajaxurl + '?action=kompass_show_ajax&module=' + module + '&method=' + ajaxmethode + '&' + params;
|
||||
}
|
||||
function kompass_load_ajax_nw(module, ajaxmethode, params='') {
|
||||
ajaxurl = kompass_generate_ajax_url(module, ajaxmethode, params);
|
||||
window.open(ajaxurl);
|
||||
}
|
||||
|
||||
function kompass_load_ajax_div(module, ajaxmethode, targetid, params = '') {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status === 200) {
|
||||
// Erfolgreiche Antwort erhalten
|
||||
document.getElementById(targetid).innerHTML = xhr.responseText;
|
||||
} else {
|
||||
console.log(xhr);
|
||||
// Fehlerbehandlung
|
||||
//console.error('Fehler beim Laden der Inhalte');
|
||||
}
|
||||
}
|
||||
};
|
||||
var scriptcall = kompass_generate_ajax_url(module, ajaxmethode, params);
|
||||
xhr.open('GET', scriptcall,true);
|
||||
xhr.send();
|
||||
}
|
BIN
assets/klilie.png
Normal file
After Width: | Height: | Size: 132 KiB |
175
assets/mareike.css
Normal file
@ -0,0 +1,175 @@
|
||||
/* Allgemeine Anpassungen */
|
||||
body {
|
||||
--ame-ms-menu-width: 250px;
|
||||
}
|
||||
|
||||
#wpwrap {
|
||||
background-color: #f3f3f1; /* Hintergrundfarbe angepasst */
|
||||
}
|
||||
|
||||
/* Admin Menü */
|
||||
#adminmenuback, #adminmenuwrap, #adminmenu {
|
||||
width: 250px;
|
||||
background-color: #ffffff; /* Hintergrundfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-has-current-submenu > .wp-submenu {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#wpcontent, #wpfooter {
|
||||
margin-left: 250px;
|
||||
background-color: #ffffff;
|
||||
padding-left: 20px; /* Padding reduziert */
|
||||
}
|
||||
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu, .folded #adminmenu .wp-has-current-submenu .wp-submenu, #adminmenu .ame-has-deep-submenu:not(.ame-has-highlighted-item) > .wp-submenu {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
/* Menüelemente */
|
||||
#adminmenu > li {
|
||||
padding: 10px 10px; /* Padding angepasst */
|
||||
font-weight: bold; /* Schriftstärke angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li a {
|
||||
color: #333; /* Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li div.wp-menu-image:before {
|
||||
color: #333; /* Iconfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li a:hover, #adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
color: #0056b3; /* Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
background-color: #e9ecef; /* Hintergrundfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-submenu, #adminmenu .wp-submenu a {
|
||||
background-color: #f8f9fa; /* Untermenü-Hintergrundfarbe angepasst */
|
||||
color: #333; /* Untermenü-Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#adminmenu .wp-submenu a:hover {
|
||||
background-color: #e9ecef; /* Untermenü-Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Untermenü-Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Admin Bar */
|
||||
#wpadminbar {
|
||||
background-color: #ffffff; /* Admin Bar Hintergrundfarbe angepasst */
|
||||
color: #0056b3; /* Admin Bar Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .ab-item, #wpadminbar a.ab-item, #wpadminbar > #wp-toolbar span.ab-label, #wpadminbar > #wp-toolbar span.noticon {
|
||||
color: #0056b3; /* Admin Bar Textfarbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .ab-icon, #wpadminbar .ab-icon:before, #wpadminbar .ab-item:before, #wpadminbar .ab-item:after {
|
||||
color: #0056b3; /* Admin Bar Icon-Farbe angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item, #wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item, #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
|
||||
background-color: #e9ecef; /* Admin Bar Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Admin Bar Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul li a:hover, #wpadminbar .quicklinks .menupop ul li a:focus {
|
||||
background-color: #e9ecef; /* Untermenü Hintergrundfarbe bei Hover angepasst */
|
||||
color: #0056b3; /* Untermenü Textfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.button-primary {
|
||||
border-style: none;
|
||||
background-color: #0056b3 !important; /* Button Hintergrundfarbe angepasst */
|
||||
color: #ffffff !important; /* Button Textfarbe angepasst */
|
||||
box-shadow: none; /* Box-Shadow entfernt */
|
||||
}
|
||||
|
||||
.button-primary:hover {
|
||||
background-color: #004085 !important; /* Button Hintergrundfarbe bei Hover angepasst */
|
||||
}
|
||||
|
||||
/* Anpassungen für Bildschirme mit unterschiedlichen Breiten */
|
||||
@media screen and (min-width: 783px) {
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 960px) and (min-width: 783px) {
|
||||
body.auto-fold #widgets-editor .interface-interface-skeleton {
|
||||
left: var(--ame-ms-collapsed-menu-width, 36px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Weitere Anpassungen */
|
||||
.nav-tab {
|
||||
border-color: #0056b3;
|
||||
background-color: #e9ecef;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.about-wrap .nav-tab-active, .nav-tab-active, .nav-tab-active:hover {
|
||||
border-style: none;
|
||||
background-color: #ffffff;
|
||||
border-bottom-color: #ffffff;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Weitere spezifische Anpassungen */
|
||||
#collapse-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Spezielle Einstellungen Box */
|
||||
.bdp_setting_box {
|
||||
margin-right: 10px;
|
||||
background-color: #ffffff;
|
||||
padding: 15px;
|
||||
border: 1px solid #1d94cf;
|
||||
}
|
||||
|
||||
.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 {
|
||||
width: 210px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-submenu li a:hover {
|
||||
background-color: #e9ecef !important;
|
||||
color: #0056b3 !important;
|
||||
}
|
||||
|
||||
.current .menu-top .wp-menu-name, .wp-has-current-submenu .wp-menu-name {
|
||||
background-color: #0056b3 !important;
|
||||
border-style: none !important;
|
||||
width: 202px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
.wp-submenu, .wp-submenu-wrap {
|
||||
background-color: #f8f9fa !important;
|
||||
width: 220px !important;
|
||||
}
|
||||
|
||||
#adminmenu .current .menu-top .wp-menu-name {
|
||||
padding: 10px;
|
||||
width: 225px !important;
|
||||
}
|
||||
}
|
43
assets/password.js
Normal file
@ -0,0 +1,43 @@
|
||||
jQuery(document).ready(function($) {
|
||||
$( "<button class='button button-primary' disabled id='password_too_short'>" +
|
||||
php_vars.password_too_short_text + "</button>" ).insertBefore( ".submit" );
|
||||
|
||||
$("#password_too_short").css('display', 'none');
|
||||
|
||||
$(document).on('DOMSubtreeModified', '#pass-strength-result', function() {
|
||||
var strengthMeter = $(this).attr('class');
|
||||
var allowedStrengths = php_vars.allowed_strengths;
|
||||
|
||||
$( "[name='pw_weak']" ).css('visibility', 'hidden');
|
||||
$( '.pw-weak' ).css('visibility', 'hidden');
|
||||
$( '#pw-weak-text-label' ).css('visibility', 'hidden');
|
||||
|
||||
if (strengthMeter !== '') {
|
||||
if (allowedStrengths.includes(strengthMeter)) {
|
||||
$("[name='pw_weak']").prop("checked", true);
|
||||
$("[name='submit']").css('display', 'inline');
|
||||
$('#createusersub').css('display', 'inline');
|
||||
$('submit').onclick = function() {
|
||||
$('your-profile').submit();
|
||||
};
|
||||
$("#createusersub").onclick = function() {
|
||||
$('createuser').submit();
|
||||
};
|
||||
|
||||
$("#password_too_short").css('display', 'none');
|
||||
} else {
|
||||
$("#createusersub").css('display', 'none');
|
||||
$("[name='submit']").prop("disabled", true);
|
||||
$("[name='pw_weak']").prop("checked", false);
|
||||
$("[name='submit']").css('display', 'none');
|
||||
$('submit').onclick = function() {
|
||||
return false;
|
||||
};
|
||||
$("#createusersub").onclick = function() {
|
||||
return false;
|
||||
};
|
||||
$("#password_too_short").css('display', 'inline');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
BIN
assets/rr.png
Normal file
After Width: | Height: | Size: 132 KiB |
21
assets/searchtable.js
Normal file
@ -0,0 +1,21 @@
|
||||
function searchTable(tableId, searchField) {
|
||||
var input, filter, table, tr, td, i, j, txtValue;
|
||||
input = searchField;
|
||||
filter = input.value.toUpperCase();
|
||||
table = document.getElementById(tableId);
|
||||
tr = table.getElementsByTagName("tr");
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td");
|
||||
for (j = 0; j < td.length; j++) {
|
||||
if (td[j]) {
|
||||
txtValue = td[j].textContent || td[j].innerText;
|
||||
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
break;
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,13 +3,11 @@
|
||||
width: 85%;
|
||||
margin: auto;
|
||||
padding: 10px;
|
||||
border-style: solid; border-color: #d0d0d0; border-radius: 10px; padding: 15px; border-width: 1px;
|
||||
box-shadow: 2px 2px 5px #c0c0c0;
|
||||
|
||||
}
|
||||
|
||||
.bdp_security_inner {
|
||||
border-style: solid; border-color: #d0d0d0; border-radius: 10px; padding: 15px; border-width: 1px;
|
||||
box-shadow: 2px 2px 5px #c0c0c0;
|
||||
|
||||
width: 80%;
|
||||
margin: 0 auto 40px;
|
||||
}
|
||||
@ -52,4 +50,16 @@
|
||||
|
||||
.long_text {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.bdp-kompass-no-blocked-ips
|
||||
{
|
||||
padding: 5px 10px;
|
||||
width: 90%;
|
||||
background-color: #ffffff;
|
||||
border-style: solid;
|
||||
border-color: #00a32a;
|
||||
border-width: 1px;
|
||||
font-weight: bold;
|
||||
font-size: 12pt;
|
||||
}
|
BIN
assets/woe.png
Normal file
After Width: | Height: | Size: 73 KiB |
@ -1,87 +1,406 @@
|
||||
#adminmenu,
|
||||
#wpadminbar,
|
||||
#adminmenuwrap,
|
||||
#adminmenuback, #adminmenuwrap, #adminmenu, #adminmenu .wp-has-current-submenu > .wp-submenu {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
|
||||
#wpcontent, #wpfooter {
|
||||
margin-left: 230px;
|
||||
background-color: #ffffff !important;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
#adminmenu .wp-submenu {
|
||||
left: 210px;
|
||||
}
|
||||
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu, .folded #adminmenu .wp-has-current-submenu .wp-submenu, #adminmenu .ame-has-deep-submenu:not(.ame-has-highlighted-item) > .wp-submenu {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
body {
|
||||
--ame-ms-menu-width: 250px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
body:not(.folded) #widgets-editor .interface-interface-skeleton {
|
||||
left: 250px;
|
||||
}
|
||||
|
||||
|
||||
#adminmenu .wp-not-current-submenu .wp-submenu {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 960px) and (min-width: 783px) {
|
||||
body.auto-fold #widgets-editor .interface-interface-skeleton {
|
||||
left: var(--ame-ms-collapsed-menu-width, 36px);
|
||||
}
|
||||
|
||||
}
|
||||
#wpwrap {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
#adminmenuback {
|
||||
background-color: #ffcb04 !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#toplevel_page_limit-login-attempts,
|
||||
#wp-admin-bar-llar-root {
|
||||
#adminmenu .wp-submenu a {
|
||||
font-weight: 200;
|
||||
}
|
||||
#adminmenu > li {
|
||||
padding: 10px 5px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
#adminmenu > li a {
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li div.wp-menu-image:before {
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li a:hover, #adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
background-color: rgb(240, 244, 247);
|
||||
color: #1d4899 !important;
|
||||
}
|
||||
|
||||
#adminmenu > li.menu-top:hover div.wp-menu-image:before, #adminmenu > li.menu-top > a:focus div.wp-menu-image:before, #adminmenu > li.opensub > a.menu-top div.wp-menu-image:before {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu, #adminmenu > li.wp-has-current-submenu .wp-submenu, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu, .folded #adminmenu > li.wp-has-current-submenu .wp-submenu a.wp-has-current-submenu:focus + .wp-submenu {
|
||||
background: #ffcb04;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.nav-tab {
|
||||
border-color: rgb(128, 159, 245);
|
||||
background-color: rgba(185, 203, 255, 0.84);
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
/* Active tabs use a bottom border color that matches the page background color. */
|
||||
.about-wrap .nav-tab-active,
|
||||
.nav-tab-active,
|
||||
.nav-tab-active:hover {
|
||||
border-style: none;
|
||||
background-color: #F0F4F7;
|
||||
border-bottom-color: #fff;
|
||||
box-shadow: 2px 2px 5px #c0c0c0;
|
||||
}
|
||||
|
||||
|
||||
.button-primary {
|
||||
border-style: none;
|
||||
background-color: #F0F4F7 !important;
|
||||
color: #404040 !important;
|
||||
box-shadow: 2px 2px 5px #c0c0c0;
|
||||
}
|
||||
|
||||
#adminmenu > li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
|
||||
border-right-color: #ffcb04;
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu .wp-submenu-head {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
.wp-has-current-submenu:hover {
|
||||
background-color: #fafafa !important;
|
||||
}
|
||||
|
||||
.wp-submenu li a {
|
||||
padding: 10px 0px 10px 10px;
|
||||
padding-top: 10px !important;
|
||||
padding-bottom: 10px !important;
|
||||
}
|
||||
|
||||
#collapse-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wp-submenu-wrap,
|
||||
.wp-submenu-head {
|
||||
color: #FFFFFF !important;
|
||||
.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;
|
||||
}
|
||||
|
||||
.wp-has-submenu,
|
||||
.wp-not-current-submenu,
|
||||
.menu-top,
|
||||
|
||||
#collapse-button,
|
||||
#wp-submenu ul,
|
||||
#wp-admin-bar-site-name,
|
||||
.ab-item
|
||||
{
|
||||
color: #46484d !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
.wp-menu-open ,
|
||||
.wp-has-current-submenu li,
|
||||
#adminmenu ul
|
||||
{
|
||||
background-color: #3163bd !important;
|
||||
color: #FFFFFF !important;
|
||||
.bdp_setting_box:first-of-type {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
.wp-not-current-submenu:hover,
|
||||
#wpadminbar .ab-item:hover
|
||||
{
|
||||
background-color: #3163bd !important;
|
||||
color: #FFFFFF !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 {
|
||||
width: 210px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.ab-submenu {
|
||||
.wp-submenu li a:hover {
|
||||
background-color: rgb(240, 244, 247) !important;
|
||||
color: #1d4899 !important;
|
||||
}
|
||||
|
||||
.current .menu-top .wp-menu-name,
|
||||
.wp-has-current-submenu .wp-menu-name {
|
||||
background-color: #ffcb04 !important;
|
||||
border-style: none !important;
|
||||
width: 202px;
|
||||
}
|
||||
|
||||
#wp-admin-bar-updates,
|
||||
#wp-admin-bar-comments,
|
||||
#wp-admin-bar-new-content,
|
||||
#wp-admin-bar-wp-logo
|
||||
.wp-has-submenu:after {
|
||||
border-right-color: #ffcb04 !important;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
.wp-submenu, .wp-submenu-wrap {
|
||||
background-color: #fafafa !important;
|
||||
width: 220px !important;
|
||||
}
|
||||
|
||||
#adminmenu .current .menu-top .wp-menu-name {
|
||||
padding: 10px;
|
||||
width: 225px !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ul#adminmenu a.wp-has-current-submenu::after, ul#adminmenu > li.current > a.current::after,
|
||||
.auto-fold ul#adminmenu a.wp-has-current-submenu::after, .auto-fold ul#adminmenu > li.current > a.current::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head, #adminmenu .wp-menu-arrow, #adminmenu .wp-menu-arrow div, #adminmenu li.current a.menu-top, #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu
|
||||
{
|
||||
display: none;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.bdp_submit:hover {
|
||||
@media screen and (max-width: 782px) {
|
||||
|
||||
#adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
background-color: #fafafa;
|
||||
color: #1d4899 !important;
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
#adminmenu .current .menu-top{
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
#adminmenu .current .menu-top .wp-menu-name {
|
||||
width: 245px !important;
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu, #adminmenu > li.wp-has-current-submenu .wp-submenu, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu, .folded #adminmenu > li.wp-has-current-submenu .wp-submenu a.wp-has-current-submenu:focus + .wp-submenu {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
|
||||
.wp-submenu:hover,
|
||||
.wp-submenu .wp-submenu-wrap:hover,
|
||||
.nav-tab-active:hover {
|
||||
border-style: none;
|
||||
background-color: #fafafa !important;
|
||||
}
|
||||
|
||||
|
||||
#adminmenuback, #adminmenuwrap, #adminmenu, #adminmenu .wp-has-current-submenu > .wp-submenu {
|
||||
width: 300px !important;
|
||||
}
|
||||
.wp-submenu,
|
||||
.wp-submenu .wp-submenu-wrap li,
|
||||
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
|
||||
background-color: #fafafa !important;
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
#wp-admin-bar-comments,
|
||||
#wp-admin-bar-new-content {
|
||||
display: none !important;
|
||||
}
|
||||
#wp-admin-bar-kompass_gruppen {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
#wp-admin-bar-kompass_events {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#adminmenu div.wp-menu-name {
|
||||
|
||||
}
|
||||
|
||||
#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: #020918;
|
||||
padding-left: 25px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#adminmenu > li .wp-submenu a:focus, #adminmenu > li .wp-submenu a:hover, #adminmenu > li.wp-has-current-submenu .wp-submenu a:focus, #adminmenu > li.wp-has-current-submenu .wp-submenu a:hover, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu a:focus, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu a:hover, .folded #adminmenu > li.wp-has-current-submenu .wp-submenu a, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu a:focus, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu a:hover {
|
||||
color: #ffcb04;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#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: #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 {
|
||||
color: #ffcb04;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#adminmenu > li.current a.menu-top, #adminmenu > li.wp-has-current-submenu a.wp-has-current-submenu, #adminmenu > li.wp-has-current-submenu .wp-submenu .wp-submenu-head, .folded #adminmenu > li.current.menu-top {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#adminmenu > li.wp-has-current-submenu div.wp-menu-image:before, #adminmenu a.current:hover div.wp-menu-image:before, #adminmenu > li.current div.wp-menu-image::before, #adminmenu > li.wp-has-current-submenu a:focus div.wp-menu-image:before, #adminmenu > li.wp-has-current-submenu.opensub div.wp-menu-image:before, #adminmenu > li:hover div.wp-menu-image:before, #adminmenu > li a:focus div.wp-menu-image:before, #adminmenu > li.opensub div.wp-menu-image:before, .ie8 #adminmenu > li.opensub div.wp-menu-image:before, #adminmenu a.current:hover div.wp-menu-image:before {
|
||||
color: #ffffff;
|
||||
background-color: #3163bd;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.bdp_submit {
|
||||
background-color: #ffffff;
|
||||
padding: 5px 25px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #769be7;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
box-shadow: 2px 2px 2px #d0d0d0;
|
||||
#adminmenu > li .awaiting-mod, #adminmenu > li .update-plugins {
|
||||
background: #ffcb04 !important;
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#bdp_success {
|
||||
background-color: #ffffff;
|
||||
border-color: #c3c4c7;
|
||||
border-left-color: #00a32a;
|
||||
padding: 10px 12px;
|
||||
margin: 5px 0 15px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-left-width: 4px;
|
||||
width: 97%;
|
||||
#adminmenu > li .current a .awaiting-mod, #adminmenu > li a.wp-has-current-submenu .update-plugins, #adminmenu > li:hover a .awaiting-mod, #adminmenu > li.menu-top:hover > a .update-plugins {
|
||||
color: #1d4899;
|
||||
background: #ffcb04;
|
||||
}
|
||||
|
||||
}
|
||||
#adminmenuback, #adminmenuwrap, #adminmenu {
|
||||
background-color: #fafafa;
|
||||
|
||||
}
|
||||
|
||||
#adminmenuback {
|
||||
box-shadow: 10px 10px 5px rgb(240, 244, 247);
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
#wpadminbar {
|
||||
background-color: rgb(240, 244, 247);
|
||||
color: #1d4899;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#wpadminbar .ab-item, #wpadminbar a.ab-item, #wpadminbar > #wp-toolbar span.ab-label, #wpadminbar > #wp-toolbar span.noticon {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#wpadminbar .ab-icon, #wpadminbar .ab-icon:before, #wpadminbar .ab-item:before, #wpadminbar .ab-item:after {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item, #wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, #wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item, #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
|
||||
background-color: #ffffff;
|
||||
color: #ffcb04;
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label, #wpadminbar:not(.mobile) > #wp-toolbar li.hover span.ab-label, #wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label, #wpadminbar:not(.mobile) li:hover .ab-icon:before, #wpadminbar:not(.mobile) li:hover .ab-item:before, #wpadminbar:not(.mobile) li:hover .ab-item:after, #wpadminbar:not(.mobile) li:hover #adminbarsearch:before {
|
||||
color: #ffcb04;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar .menupop .ab-sub-wrapper {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary, #wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar .ab-submenu .ab-item, #wpadminbar .quicklinks .menupop ul li a, #wpadminbar .quicklinks .menupop.hover ul li a, #wpadminbar.nojs .quicklinks .menupop:hover ul li a {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks li .blavatar, #wpadminbar .menupop .menupop > .ab-item:before {
|
||||
color: #f3f3f1;
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul li a {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul li a:hover, #wpadminbar .quicklinks .menupop ul li a:focus, #wpadminbar .quicklinks .menupop ul li a:hover strong, #wpadminbar .quicklinks .menupop ul li a:focus strong, #wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a, #wpadminbar .quicklinks .menupop.hover ul li a:hover, #wpadminbar .quicklinks .menupop.hover ul li a:focus, #wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover, #wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus, #wpadminbar li:hover .ab-icon:before, #wpadminbar li:hover .ab-item:before, #wpadminbar li a:focus .ab-icon:before, #wpadminbar li .ab-item:focus:before, #wpadminbar li .ab-item:focus .ab-icon:before, #wpadminbar li.hover .ab-icon:before, #wpadminbar li.hover .ab-item:before, #wpadminbar li:hover #adminbarsearch:before, #wpadminbar li #adminbarsearch.adminbar-focused:before, #wpadminbar .quicklinks li a:hover .blavatar, #wpadminbar .quicklinks li a:focus .blavatar, #wpadminbar .quicklinks .ab-sub-wrapper .menupop.hover > a .blavatar, #wpadminbar .menupop .menupop > .ab-item:hover:before, #wpadminbar.mobile .quicklinks .ab-icon:before, #wpadminbar.mobile .quicklinks .ab-item:before {
|
||||
color: #1d4899;
|
||||
background-color: rgb(240, 244, 247);
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info .display-name {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info a:hover .display-name {
|
||||
color: #ffcb04;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info .username {
|
||||
color: #1d4899;
|
||||
}
|
||||
|
||||
#wpadminbar.mobile .quicklinks .hover .ab-icon:before, #wpadminbar.mobile .quicklinks .hover .ab-item:before, #wpadminbar #adminbarsearch:before {
|
||||
color: #f3f3f1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
li.wp-has-submenu.wp-not-current-submenu.opensub:after,
|
||||
li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after,
|
||||
|
||||
.wp-menu-name:after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#adminmenu .wp-menu-arrow div {
|
||||
display: none !important;
|
||||
background-color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.bdp-newplugin-button:hover {
|
||||
color: #ffffff !important;
|
||||
background-color: #1d4899 !important;
|
||||
}
|
||||
|
||||
.bdp-newplugin-button {
|
||||
background-color: #ffffff !important;
|
||||
padding: 5px 20px !important;
|
||||
cursor: pointer !important;
|
||||
color: #1d4899 !important;
|
||||
}
|
||||
|
275
bdp-kompass.php
@ -2,201 +2,146 @@
|
||||
/**
|
||||
* 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.1.1
|
||||
* Version: 4.8.3
|
||||
* Tags: bdp, utility, helper
|
||||
* Requires at least: 6.0
|
||||
* Requires PHP: 8.2
|
||||
* Author: Thomas Günther
|
||||
* Author URI: https://www.sachsen.pfadfinden.de
|
||||
* Update URI: https://lv-sachsen-main.bdp.mein-verein.online/wordpress/
|
||||
* Update URI: http://lv-sachsen-main.bdp.mein-verein.online/wordpress/
|
||||
* Text Domain: bdp-kompass
|
||||
*/
|
||||
|
||||
use Bdp\Libs\WpConfigEditor;
|
||||
use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain;
|
||||
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
|
||||
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
|
||||
use Bdp\Modules\Mail\Controllers\MailController;
|
||||
use Bdp\Modules\Mail\Controllers\MailSettingsController;
|
||||
use Bdp\Modules\Security\Security;
|
||||
use Bdp\Modules\Seo\Seo;
|
||||
|
||||
|
||||
define('BDP_LV_PLUGIN_DIR', ABSPATH . '/wp-content/plugins/bdp-kompass/');
|
||||
define('BDP_LV_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
define('BDP_LV_PLUGIN_SLUG', 'bdp-kompass');
|
||||
|
||||
require_once BDP_LV_PLUGIN_DIR . 'core/fileloader.php';
|
||||
|
||||
|
||||
bdp_create_menu_structure();
|
||||
require_once dirname(__FILE__) . '/includes/setup.php';
|
||||
|
||||
function bdp_plugin_install() {
|
||||
Seo::setup();
|
||||
Calendar::setup();
|
||||
Security::setup();
|
||||
update_option('kompass_installation', true);
|
||||
}
|
||||
|
||||
function bdp_plugin_init()
|
||||
{
|
||||
remove_menu_page('admin.php?page=limit-login-attempts&tab=dashboard');
|
||||
if (get_option('kompass_installation') == true) {
|
||||
delete_option('kompass_installation');
|
||||
wp_redirect('admin.php?page=bdp-kompass%2Fmodules%2Findex.php&loadmodule=firstusage');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
register_activation_hook(__FILE__, 'bdp_plugin_install');
|
||||
add_action('init', 'bdp_plugin_init');
|
||||
function bdp_plugin_init() {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
Security::ProhibitBots();
|
||||
Security::SetPageFilters();
|
||||
|
||||
# WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
|
||||
|
||||
if (null == get_option('kompass_already_installed', null)) {
|
||||
Seo::setup();
|
||||
Security::setup();
|
||||
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();
|
||||
new EventsMain();
|
||||
new MailController();
|
||||
|
||||
|
||||
|
||||
});
|
||||
add_action('wp_ajax_kompass_show_ajax', 'kompass_load_ajax_content');
|
||||
add_action('wp_ajax_nopriv_kompass_show_ajax', 'kompass_load_ajax_content');
|
||||
|
||||
function register_custom_theme_directory() {
|
||||
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/buena/' ;
|
||||
if (is_dir(ABSPATH . '/wp-content/themes/mareike-theme/')) {
|
||||
return;
|
||||
}
|
||||
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/lib/mareike-theme/' ;
|
||||
|
||||
system('mkdir ' . ABSPATH . 'wp-content/themes/buena/');
|
||||
system('cp -r ' . $file . '* ' . ABSPATH . 'wp-content/themes/buena/');
|
||||
system('mkdir ' . ABSPATH . '/wp-content/themes/mareike-theme/');
|
||||
system('cp -r ' . $file . '* ' . ABSPATH . '/wp-content/themes/mareike-theme/');
|
||||
|
||||
switch_theme('buena');
|
||||
}
|
||||
|
||||
#add_action( 'after_setup_theme', 'register_custom_theme_directory' );
|
||||
function enqueue_custom_password_js() {
|
||||
wp_enqueue_script( 'kompass-ajax', BDP_LV_PLUGIN_URL . '/assets/ajax.js');
|
||||
wp_enqueue_script( 'searchable-table', BDP_LV_PLUGIN_URL . '/assets/searchtable.js');
|
||||
wp_enqueue_script( 'custom-password-js', BDP_LV_PLUGIN_URL . 'assets/password.js');
|
||||
wp_localize_script( 'custom-password-js', 'php_vars', [
|
||||
'allowed_strengths' => kompass_get_minimal_password_strength(),
|
||||
'password_too_short_text' => 'Dass Passwort entspricht nicht den Anforderungen.'
|
||||
]);
|
||||
}
|
||||
|
||||
class BdpVersionChecker
|
||||
{
|
||||
public $plugin_slug;
|
||||
public $version;
|
||||
public $cache_key;
|
||||
public $cache_allowed;
|
||||
public $updateUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$plugin_data = get_plugin_data(__FILE__);
|
||||
$this->plugin_slug = 'bdp-kompass';
|
||||
$this->updateUrl = $plugin_data['UpdateURI'] . '/info.json';
|
||||
$this->version = $plugin_data['Version'];
|
||||
$this->cache_key = 'bdp_kompass_upd';
|
||||
$this->cache_allowed = true;
|
||||
add_action( 'after_setup_theme', 'kompass_after_setup_theme' );
|
||||
|
||||
add_filter('plugins_api', array($this, 'info'), 20, 3);
|
||||
add_filter('site_transient_update_plugins', array($this, 'update'));
|
||||
add_action('upgrader_process_complete', array($this, 'purge'), 10, 2);
|
||||
}
|
||||
add_action( 'admin_menu', ['Bdp\Modules\KompassSettings\Controllers\SettingsPage', 'add_menu'] );
|
||||
|
||||
public function request()
|
||||
{
|
||||
$remote = get_transient($this->cache_key);
|
||||
|
||||
if (false === $remote || !$this->cache_allowed) {
|
||||
|
||||
$remote = wp_remote_get(
|
||||
$this->updateUrl
|
||||
,
|
||||
array(
|
||||
'timeout' => 10,
|
||||
'headers' => array(
|
||||
'Accept' => 'application/json'
|
||||
)
|
||||
)
|
||||
);
|
||||
function crp_custom_register_form() {
|
||||
|
||||
if (
|
||||
is_wp_error($remote)
|
||||
|| 200 !== wp_remote_retrieve_response_code($remote)
|
||||
|| empty(wp_remote_retrieve_body($remote))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
add_action('register_form', ['Bdp\Modules\Registration\Controllers\ExtendRegistrationForm', 'execute']);
|
||||
|
||||
// Validate registration form fields
|
||||
add_filter('registration_errors', ['Bdp\Modules\Registration\Controllers\ExtendRegistrationForm', 'error_messages'], 10, 3);
|
||||
|
||||
// Save custom user meta data
|
||||
add_action('user_register', ['\Bdp\Modules\Registration\Controllers\SaveRegistration', 'execute']);
|
||||
|
||||
// Handle account activation
|
||||
|
||||
add_action('init', ['Bdp\Modules\Registration\Controllers\SaveRegistration', 'activate_user']);
|
||||
|
||||
// Prevent login if account is not activated
|
||||
|
||||
add_filter('authenticate', ['Bdp\Modules\Registration\Controllers\SaveRegistration', 'check_user_activation'], 30, 3);
|
||||
|
||||
function crp_allow_umlauts_in_usernames($username, $raw_username, $strict) {
|
||||
if (!$strict) {
|
||||
return $username;
|
||||
}
|
||||
|
||||
// Allow letters, numbers, underscores, spaces, periods, hyphens, and umlauts
|
||||
$username = preg_replace('/[^a-zA-Z0-9 _.\-äöüÄÖÜß]/', '', $raw_username);
|
||||
|
||||
return $username;
|
||||
}
|
||||
add_filter('sanitize_user', 'crp_allow_umlauts_in_usernames', 10, 3);
|
||||
|
||||
|
||||
add_action('login_message', ['Bdp\Modules\Registration\Controllers\SaveRegistration','display_custom_message']);
|
||||
|
||||
if (false === (bool)get_option('user_can_register', false)) {
|
||||
|
||||
add_filter('registration_errors', 'kompass_disable_user_registration', 10, 3);
|
||||
|
||||
function kompass_disable_user_registration($errors, $sanitized_user_login, $user_email) {
|
||||
$errors->add('registration_disabled', __('Die Registrierung ist derzeit deaktiviert.'));
|
||||
return $errors;
|
||||
}
|
||||
|
||||
add_action('login_enqueue_scripts', 'kompass_remove_register_link');
|
||||
|
||||
function kompass_remove_register_link() {
|
||||
?>
|
||||
<style>
|
||||
#registerform {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
set_transient($this->cache_key, $remote, 3600);
|
||||
}
|
||||
|
||||
$remote = json_decode(wp_remote_retrieve_body($remote));
|
||||
return $remote;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function info($res = '', $action = '', $args = '')
|
||||
{
|
||||
if (!isset($args->slug) || $args->slug !== $this->plugin_slug) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
// get updates
|
||||
$remote = $this->request();
|
||||
if (!$remote) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$res = new stdClass();
|
||||
|
||||
$res->name = $remote->name;
|
||||
$res->slug = $remote->slug;
|
||||
$res->version = $remote->version;
|
||||
$res->tested = $remote->tested;
|
||||
$res->requires = $remote->requires;
|
||||
$res->author = $remote->author;
|
||||
$res->author_profile = $remote->author_profile;
|
||||
$res->download_link = $remote->download_url;
|
||||
$res->trunk = $remote->download_url;
|
||||
$res->requires_php = $remote->requires_php;
|
||||
$res->last_updated = $remote->last_updated;
|
||||
|
||||
$res->sections = array(
|
||||
'description' => $remote->sections->description,
|
||||
'installation' => $remote->sections->installation,
|
||||
'changelog' => $remote->sections->changelog
|
||||
);
|
||||
|
||||
if (!empty($remote->banners)) {
|
||||
$res->banners = array(
|
||||
'low' => $remote->banners->low,
|
||||
'high' => $remote->banners->high
|
||||
);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($transient)
|
||||
{
|
||||
if (empty($transient->checked)) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
$remote = $this->request();
|
||||
if(
|
||||
$remote
|
||||
&& version_compare( $this->version, $remote->version, '<' )
|
||||
&& version_compare( $remote->requires, get_bloginfo( 'version' ), '<=' )
|
||||
&& version_compare( $remote->requires_php, PHP_VERSION, '<' )
|
||||
) {
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( __FILE__ );
|
||||
$res->new_version = $remote->version;
|
||||
$res->tested = $remote->tested;
|
||||
$res->package = $remote->download_url;
|
||||
|
||||
$transient->response[ $res->plugin ] = $res;
|
||||
|
||||
} else {
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( __FILE__ );
|
||||
$transient->no_update[ $res->plugin ] = $res;
|
||||
}
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
public function purge($upgrader, $options)
|
||||
{
|
||||
if (
|
||||
$this->cache_allowed
|
||||
&& 'update' === $options['action']
|
||||
&& 'plugin' === $options['type']
|
||||
) {
|
||||
delete_transient($this->cache_key);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
$class = new BdpVersionChecker();
|
||||
|
||||
add_filter( 'plugins_api', array( $class, 'info' ), 20, 3 );
|
||||
MailSettingsController::set_smtp_if_required();
|
||||
|
||||
|
||||
|
@ -1,96 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 7]>
|
||||
<html class="ie ie7" <?php language_attributes(); ?>>
|
||||
<![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="ie ie8" <?php language_attributes(); ?>>
|
||||
<![endif]-->
|
||||
<!--[if !(IE 7) | !(IE 8) ]><!-->
|
||||
<html <?php language_attributes(); ?>>
|
||||
<!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut icon" href="<?php echo esc_url( get_template_directory_uri() ); ?>/img/favicon.ico" />
|
||||
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
|
||||
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<!-- FIXME: Mehr ARIA role setzen -->
|
||||
<body <?php body_class(); ?>>
|
||||
<div id="wrap"><!-- FIXME: Klassen hfeed, site? -->
|
||||
<header id="header" role="banner"><!-- FIXME: Klasse site-header? -->
|
||||
<hgroup id="branding">
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e( 'Zurück zur Startseite', 'buena-theme' ); ?>">
|
||||
<img alt="Bund der Pfadfinderinnen und Pfadfinder" src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png" srcset="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png 1x, <?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen@2x.png 2x" width="390" height="79" />
|
||||
</a>
|
||||
</h1>
|
||||
<h2 class="site-description">
|
||||
<?php echo esc_html( get_bloginfo( 'name', 'display' ) ); ?>
|
||||
</h2>
|
||||
</hgroup>
|
||||
<nav class="screen-reader-text">
|
||||
<!-- FIXME: Tollere Navigation ausdenken -->
|
||||
<a href="#content">
|
||||
<?php _e( 'Zum Inhalt springen', 'buena-theme' ); ?>
|
||||
</a>
|
||||
</nav>
|
||||
<?php do_action( 'buena_search_form' ); ?>
|
||||
</header>
|
||||
<div id="left">
|
||||
<?php wp_nav_menu( [ 'theme_location' => 'primary', 'depth' => 2, 'container' => 'nav', 'container_class' => 'nav-menu' ] ); ?>
|
||||
<?php if ( is_active_sidebar( 'below-navigation' ) ): ?>
|
||||
<ul class="widgets">
|
||||
<?php dynamic_sidebar( 'below-navigation' ); ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="teaser">
|
||||
<?php if ( is_page() || have_posts() && is_single() ): the_post(); ?>
|
||||
<?php if ( has_post_thumbnail() ): ?>
|
||||
<?php the_post_thumbnail( 'poster', [ 'alt' => '' ] ); ?>
|
||||
<?php else: ?>
|
||||
<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
<div id="teaserTitle">
|
||||
<h2><?php the_title(); ?></h2>
|
||||
</div>
|
||||
<?php rewind_posts(); ?>
|
||||
<?php elseif ( get_header_image() ): ?>
|
||||
<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
|
||||
<div id="teaserTitle">
|
||||
<h2><?php bloginfo( 'description' ); ?></h2>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="main" role="main">
|
||||
<div id="content">
|
||||
<?php if ( have_posts() ): ?>
|
||||
<?php while ( have_posts() ): the_post(); ?>
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
<?php else: // FIXME: Wenn berechtigt: Erstellen anbieten ?>
|
||||
<article id="post-0" class="post no-results not-found">
|
||||
<?php _e( 'Nicht gefunden.', 'buena-theme' ); ?>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<nav class="pagination">
|
||||
<div class="previous"><?php previous_posts_link( __( '« Neuere Beiträge', 'buena-theme' ) ); ?></div>
|
||||
<div class="next"><?php next_posts_link( __( 'Ältere Beiträge »', 'buena-theme' ) ); ?></div>
|
||||
</nav>
|
||||
<?php comments_template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( is_active_sidebar( 'footer' ) ): ?>
|
||||
<footer id="footer">
|
||||
<ul class="widgets">
|
||||
<?php dynamic_sidebar( 'footer' ); ?>
|
||||
</ul>
|
||||
</footer>
|
||||
<?php endif; ?>
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
if ( post_password_required() ) {
|
||||
printf( '<p class="nocomments">%s</p>', __( 'Kommentare werden erst angezeigt, wenn das Kennwort eingegeben wurde.', 'buena-theme' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: Hier sollten die Social-Media-Knöpfe auftauchen…
|
||||
|
||||
?>
|
||||
<div class="comments">
|
||||
<?php if ( have_comments() ) : ?>
|
||||
<h4 id="comments"><?php comments_number( 'Keine Kommentare', 'Ein Kommentar', '% Kommentare' );?></h4>
|
||||
<ul class="commentlist">
|
||||
<?php wp_list_comments(); ?>
|
||||
</ul>
|
||||
<nav class="pagination">
|
||||
<div class="alignleft"><?php previous_comments_link() ?></div>
|
||||
<div class="alignright"><?php next_comments_link() ?></div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<?php if ( comments_open() ) : ?>
|
||||
<?php comment_form(); ?>
|
||||
<?php else: ?>
|
||||
<p class="nocomments screen-reader-text"><?php _e( 'Es kann nicht kommentiert werden.', 'buena-theme' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
@ -1,17 +0,0 @@
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?>>
|
||||
<?php if ( is_singular() ): ?>
|
||||
<?php the_content(); ?>
|
||||
<p><?php the_tags(); ?></p>
|
||||
<?php wp_link_pages( array( 'before' => '<nav class="page-links">Seiten:', 'after' => '</nav>' ) ); ?>
|
||||
<?php else: ?>
|
||||
<a class="h h-box h-box-blaugelb<?php if ( ! has_post_thumbnail() ): ?> h-box-blaugelb-bildlos<?php endif; ?>" href="<?php echo esc_url( get_permalink() ); ?>">
|
||||
<?php the_post_thumbnail( 'gallery-thumb', [ 'alt' => '' ] ); ?>
|
||||
<?php if ( get_the_title() ): ?>
|
||||
<header class="wrap">
|
||||
<h3><?php the_title(); ?></h3>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php has_excerpt() ? the_excerpt() : the_content(); ?>
|
||||
<?php endif; ?>
|
||||
</article>
|
@ -1,104 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
@import url("font/ihs.css");
|
||||
|
||||
html, body { border: 0 none; padding: 0; margin: 0; min-height: 100%; position: static; }
|
||||
html { font-family: Sans-Serif; background: url("img/holz.jpg") #dbb97b; position: relative; }
|
||||
body { margin: 1em; padding: 1em; max-width: 710px; background: #fff; font-size: 81.3% !important; }
|
||||
body.post-type-gallery { background: transparent; }
|
||||
header, hgroup, nav, footer, article { display: block; }
|
||||
.h, h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { margin: 0; font-family: IHS, Serif; font-size: 1em; font-weight: normal; font-style: normal; }
|
||||
button, input, select, optgroup, option { margin: 0; font: inherit; color: inherit; }
|
||||
button, input[type="button"], input[type="submit"], input[type="reset"] { cursor: pointer; }
|
||||
p, ul, ol, dt { line-height: 1.5; }
|
||||
abbr { border-bottom: 1px dotted; }
|
||||
a { color: #1d4899; }
|
||||
figure, .wp-caption { margin: 0; max-width: 100%; }
|
||||
figcaption, .wp-caption-text { font-style: italic; padding: 0.5em 0; }
|
||||
.screen-reader-text { display: none; }
|
||||
.aligncenter { margin: 0 auto; }
|
||||
.alignleft { float: left; margin: 0 1em 0 0; }
|
||||
.alignright { float: right; margin: 0 0 0 1em; }
|
||||
|
||||
::-moz-selection { background: #1d4899; color: #ffcb04; text-shadow: none; outline: 2px solid #1d4899; }
|
||||
::selection { background: #1d4899; color: #ffcb04; text-shadow: none; outline: 2px solid #1d4899; }
|
||||
|
||||
/* Media object */
|
||||
.media { margin: 1em 0; }
|
||||
.media, .bd { overflow: hidden; _overflow: visible; }
|
||||
/*.media img { display: block; }*/
|
||||
/* Clearfix */
|
||||
.clearfix::after,
|
||||
.clearfix::before,
|
||||
.media::after,
|
||||
.media::before { content: " "; display: table; }
|
||||
.clearfix::after,
|
||||
.media::after { clear: both; }
|
||||
|
||||
/* Überschriften mit Bild darunter */
|
||||
.h-box { position: relative; display: block; margin-bottom: 1em; text-decoration: none; }
|
||||
.h-box > img { position: absolute; top: 0; left: 0; height: 100%; width: 100%; }
|
||||
.h-box > .wrap { position: absolute; max-width: 100%; left: 0; }
|
||||
.h-box > .wrap > * { display: inline; -o-box-decoration-break: clone; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
|
||||
|
||||
.h-box-teaser { box-shadow: 0 5px 5px rgba(0, 0, 0, 0.3); margin-left: -240px; line-height: 1; display: inline-block; width: 1300px; max-width: 100%; }
|
||||
.h-box-teaser > img { position: static; }
|
||||
.h-box-teaser > .wrap { bottom: 1em; padding-left: 240px; }
|
||||
.h-box-teaser > .wrap > * { background: rgba(56, 46, 35, 0.7); color: #ffcb04; padding: 2px 13px 4px; font-size: 52px; line-height: 78px; }
|
||||
@media (max-width: 720px) {
|
||||
.h-box-teaser { margin-top: 1em; margin-left: 0; }
|
||||
.h-box-teaser > .wrap { padding-left: 1em; }
|
||||
.h-box-teaser > .wrap > * { font-size: 2em; line-height: 39px; }
|
||||
}
|
||||
|
||||
.h-box-blaugelb { padding-top: 47.1428571%; }
|
||||
.h-box-blaugelb > .wrap { bottom: 0; font-size: 18px; }
|
||||
.h-box-blaugelb > .wrap > * { color: #1d4899; background: #ffcb04; padding: 3px 5px; line-height: 26px; }
|
||||
|
||||
.h-box-blaugelb-bildlos { padding: 0; }
|
||||
.h-box-blaugelb-bildlos > .wrap { position: static; }
|
||||
/**/
|
||||
|
||||
.container { max-width: 1020px; }
|
||||
.page .container,
|
||||
.single-post:not(.single-format-gallery) .container { max-width: 710px; }
|
||||
|
||||
.content-singular .format-gallery { background: transparent; padding: 0; margin: 0; position: relative; }
|
||||
.content-singular .format-gallery .gallery { display: flex; flex-wrap: wrap; align-content: space-between; align-items: flex-start; }
|
||||
.content-singular .format-gallery .gallery-item { background: #fff; padding: 1em; margin: 0 1em 1em 0; }
|
||||
.gallery-columns-1 .gallery-item { flex: 1 0 50%; }
|
||||
.gallery-columns-2 .gallery-item { flex: 1 0 34%; }
|
||||
.gallery-columns-3 .gallery-item { flex: 1 0 25%; }
|
||||
.gallery-columns-4 .gallery-item { flex: 1 0 20%; }
|
||||
|
||||
.content-gallery { display: flex; position: relative; z-index: 10; flex-wrap: wrap; overflow: hidden; }
|
||||
.content-gallery > article { flex: 1 1 25%; }
|
||||
body > :first-child { margin-top: 0; }
|
||||
body > :last-child { margin-bottom: 0; }
|
||||
.content-singular > article:not(.format-gallery),
|
||||
.content-gallery > article,
|
||||
.commentlist article,
|
||||
.comment-form { min-width: 20em; background: #fff; box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1); }
|
||||
.content-gallery > article { max-width: calc(33.333% - 1em); }
|
||||
@media (max-width: 800px) { .content-gallery > article { max-width: 100%; } }
|
||||
|
||||
/* WordPress-Wünsche */
|
||||
.sticky {}
|
||||
|
||||
img { max-width: 100%; height: auto; border: 0 none; vertical-align: middle; }
|
||||
ul, ol { padding-left: 2em; }
|
||||
dl, ul, ol, h1, h2, h3, h4, h5, h6, blockquote, p, table { margin: 0.5em 0; }
|
||||
dd, li > ol, li > ul { margin: 0; }
|
||||
dt { font-weight: bold; }
|
||||
blockquote, dd { padding-left: 2em; }
|
||||
body > p:empty:last-child { margin: -0.5em 0 0.5em; }
|
||||
h3, .h3, h4, .h4, h5, .h5, h6, .h6 { display: inline-block; background: #ffcb04; color: #1d4899; margin-bottom: 0; padding: 2px 4px; }
|
||||
h3, .h3 { font-size: 18px; padding: 3px 5px; }
|
||||
h4, .h4 { font-size: 16px; }
|
||||
h5, .h5 { font-size: 14px; }
|
||||
.gallery-caption {}
|
||||
.bypostauthor {}
|
||||
.twitter-tweet {}
|
||||
|
||||
h1, .h1, h2, .h2 { font-size: 20px; }
|
||||
h1::after, h2::after { color: red; background: black; display: block; padding: 5px; content: "Bitte Überschriften ab 3. Ordnung benutzen."; }
|
@ -1,11 +0,0 @@
|
||||
@font-face {
|
||||
font-family: IHS;
|
||||
src: url('ihs.eot');
|
||||
src: url('ihs.eot?#iefix') format('embedded-opentype'),
|
||||
url('ihs.woff2') format('woff2'),
|
||||
url('ihs.woff') format('woff'),
|
||||
url('ihs.ttf') format('truetype'),
|
||||
url('ihs.svg#immenhausenregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
1825
buena/font/ihs.svg
Before Width: | Height: | Size: 135 KiB |
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'I’m a theme.' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'trigger_pfadfinden_plugin_error' ) ) {
|
||||
/**
|
||||
* Show an error message.
|
||||
*
|
||||
* @see http://www.squarepenguin.com/wordpress/?p=6 Inspiration
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $type optional
|
||||
* @return bool
|
||||
*/
|
||||
function trigger_pfadfinden_plugin_error( $message, $type = 0 )
|
||||
{
|
||||
if ( isset( $_GET['action'] ) && 'error_scrape' === $_GET['action'] ) {
|
||||
echo $message;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! $type ) {
|
||||
$type = E_USER_WARNING;
|
||||
}
|
||||
|
||||
return trigger_error( $message, $type );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for suitable environment
|
||||
if ( defined( 'PHP_VERSION_ID' ) && PHP_VERSION_ID >= 50400 ) {
|
||||
// Register autoloader if updater plugin missing
|
||||
if ( ! class_exists( 'Shy\WordPress\Theme' ) ) {
|
||||
if ( ! include_once __DIR__ . '/use/shy-wordpress/src/autoloader.php' ) {
|
||||
trigger_pfadfinden_plugin_error(
|
||||
__( 'Das Theme ist unvollständig und konnte nicht geladen werden. Neuinstallation müsste helfen.', 'buena-theme' ),
|
||||
E_USER_ERROR
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Register our autoloader
|
||||
if ( ! include_once __DIR__ . '/src/autoloader.php' ) {
|
||||
trigger_pfadfinden_plugin_error(
|
||||
__( 'Das Theme ist unvollständig und konnte nicht geladen werden. Neuinstallation müsste helfen.', 'buena-theme' ),
|
||||
E_USER_ERROR
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Pfadfinden\WordPress\BuenaTheme
|
||||
*/
|
||||
function buena_get_theme()
|
||||
{
|
||||
static $theme = null;
|
||||
if (!$theme) {
|
||||
$theme = new ReflectionClass( 'Pfadfinden\WordPress\BuenaTheme' );
|
||||
$theme = $theme->newInstance();
|
||||
}
|
||||
|
||||
return $theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @return callable
|
||||
*/
|
||||
function buena_get_callback( $method )
|
||||
{
|
||||
return array( buena_get_theme(), (string) $method );
|
||||
}
|
||||
|
||||
return buena_get_theme();
|
||||
}
|
||||
|
||||
|
||||
// Display error message
|
||||
trigger_pfadfinden_plugin_error(
|
||||
sprintf(
|
||||
__( 'You need at least PHP 5.4 to use the Buena theme. Your are using %s.', 'buena-theme' ),
|
||||
PHP_VERSION
|
||||
),
|
||||
E_USER_ERROR
|
||||
);
|
Before Width: | Height: | Size: 783 B |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 332 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 561 B |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 34 KiB |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2400 2400" width="14" height="14"><path style="fill:#fff;stroke:none" d="m 975,25 q 129,0 252,34 123,34 227,95.5 104,61.5 191.5,149 87.5,87.5 149,192 61.5,104.5 95.5,227.5 34,123 34,251 0,278 -152,514 l 588,588 q 15,14 15,35 0,21 -15,36 l -213,213 q -15,15 -36,15 -21,0 -35,-15 l -588,-588 q -235,152 -513,152 -129,0 -252,-34 Q 600,1856 496,1794.5 392,1733 304,1645.5 216,1558 155,1453.5 94,1349 59.5,1226 25,1103 25,974.5 25,846 59.5,723 94,600 155,495.5 216,391 304,303.5 392,216 496,154.5 600,93 723,59 846,25 975,25 Z m -0.5,302 Q 843,327 723,378 603,429 516.5,516 430,603 378.5,723 327,843 327,974.5 q 0,131.5 51.5,251.5 51.5,120 138,207 86.5,87 206.5,138 120,51 251.5,51 131.5,0 251.5,-51 120,-51 207,-138 87,-87 138.5,-207 Q 1623,1106 1623,974.5 1623,843 1571.5,723 1520,603 1433,516 1346,429 1226,378 1106,327 974.5,327 Z" /></svg>
|
Before Width: | Height: | Size: 907 B |
@ -1 +0,0 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg' height='300' width='470' viewBox='0 0 300 425' preserveAspectRatio='xMinYMin meet'><defs><linearGradient id='v' x1='0' y1='0' x2='0' y2='140%'><stop offset='0' stop-color='#000' stop-opacity='0.7' /><stop offset='50%' stop-color='#000' stop-opacity='0.4' /><stop offset='80%' stop-color='#000' stop-opacity='0.1' /><stop offset='100%' stop-color="#000" stop-opacity='0' /></linearGradient></defs><path d='M10,200 C150,170 450,180 615,190 L608,00 L15,0 Z' style='stroke:none;' fill='url(#v)'></path></svg>
|
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 21 KiB |
106
buena/index.php
@ -1,106 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 7]>
|
||||
<html class="ie ie7" <?php language_attributes(); ?>>
|
||||
<![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="ie ie8" <?php language_attributes(); ?>>
|
||||
<![endif]-->
|
||||
<!--[if !(IE 7) | !(IE 8) ]><!-->
|
||||
<html <?php language_attributes(); ?>>
|
||||
<!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<?php if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() ): // FIXME: Remove workaround on 2016-02-16 ?>
|
||||
<link rel="shortcut icon" href="<?php echo esc_url( get_template_directory_uri() ); ?>/img/favicon.ico" />
|
||||
<?php endif; ?>
|
||||
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
|
||||
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<!-- FIXME: Mehr ARIA role setzen -->
|
||||
<body <?php body_class(); ?>>
|
||||
<div id="wrap"><!-- FIXME: Klassen hfeed, site? -->
|
||||
<header id="header" role="banner"><!-- FIXME: Klasse site-header? -->
|
||||
<hgroup id="branding">
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e( 'Zurück zur Startseite', 'buena-theme' ); ?>">
|
||||
<img alt="Bund der Pfadfinderinnen und Pfadfinder" src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png" srcset="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png 1x, <?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen@2x.png 2x" width="390" height="79" />
|
||||
</a>
|
||||
</h1>
|
||||
<h2 class="site-description">
|
||||
<?php echo esc_html( get_bloginfo( 'name', 'display' ) ); ?>
|
||||
</h2>
|
||||
</hgroup>
|
||||
<nav>
|
||||
<!-- FIXME: Tollere Navigation ausdenken -->
|
||||
<a href="#content" class="screen-reader-text"><?php _e( 'Zum Inhalt springen', 'buena-theme' ); ?></a>
|
||||
<button type="button" id="responsiveMenu" title="<?php esc_attr_e( 'Menü', 'buena-theme' ); ?>">
|
||||
<img alt="<?php esc_attr_e( 'Menü', 'buena-theme' ); ?>" src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/hamburger.png" width="32" height="32" />
|
||||
</button>
|
||||
</nav>
|
||||
<?php do_action( 'buena_search_form' ); ?>
|
||||
</header>
|
||||
<div id="left">
|
||||
<?php wp_nav_menu( [ 'theme_location' => 'primary', 'depth' => 2, 'container' => 'nav', 'container_class' => 'nav-menu nav-menu-primary' ] ); ?>
|
||||
<?php if ( is_active_sidebar( 'below-navigation' ) ): ?>
|
||||
<ul class="widgets">
|
||||
<?php dynamic_sidebar( 'below-navigation' ); ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( $buenaTeaserImage = buena_get_theme()->getTeaserImage() ): ?>
|
||||
<header class="h h-box h-box-teaser">
|
||||
<?php echo $buenaTeaserImage; ?>
|
||||
<hgroup class="wrap">
|
||||
<h2><?php buena_get_theme()->printTitle(); ?></h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
<?php else: ?>
|
||||
<header class="h">
|
||||
<h2><?php buena_get_theme()->printTitle(); ?></h2>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<div id="main" role="main" class="container">
|
||||
<div id="content" class="content-<?php if ( is_singular() ): ?>singular<?php else: ?>gallery<?php endif; ?>">
|
||||
<?php if ( have_posts() ): ?>
|
||||
<?php while ( have_posts() ): the_post(); ?>
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
<?php else: // FIXME: Wenn berechtigt: Erstellen anbieten ?>
|
||||
<article id="post-0" class="post no-results not-found">
|
||||
<?php _e( 'Nicht gefunden.', 'buena-theme' ); ?>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<nav class="pagination">
|
||||
<div class="alignright"><?php next_posts_link( __( 'Ältere Beiträge »', 'buena-theme' ) ); ?></div>
|
||||
<div class="alignleft"><?php previous_posts_link( __( '« Neuere Beiträge', 'buena-theme' ) ); ?></div>
|
||||
</nav>
|
||||
<?php comments_template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="footer">
|
||||
<div class="wrapper media">
|
||||
<?php if ( is_active_sidebar( 'footer' ) || has_nav_menu( 'footer' ) ): ?>
|
||||
<header class="h">
|
||||
<?php echo esc_html( get_bloginfo( 'name', 'display' ) ?: 'Bund der Pfadfinderinnen und Pfadfinder e.V.' ); ?>
|
||||
</header>
|
||||
<?php wp_nav_menu( [ 'theme_location' => 'footer', 'container' => 'nav', 'container_class' => 'nav-menu nav-menu-footer alignleft', 'fallback_cb' => '' ] ); ?>
|
||||
<ul class="widgets bd">
|
||||
<?php dynamic_sidebar( 'footer' ); ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</footer>
|
||||
<script>
|
||||
+function() {
|
||||
document.getElementById('responsiveMenu').addEventListener('click', function() {
|
||||
document.body.classList.toggle('show-responsive-menu');
|
||||
});
|
||||
}();
|
||||
</script>
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
103
buena/readme.txt
@ -1,103 +0,0 @@
|
||||
Buena
|
||||
=======
|
||||
|
||||
Das WordPress-Theme zum neuen Corporate Design des BdP.
|
||||
|
||||
Änderungswünsche? Kritik?
|
||||
philipp.cordes@pfadfinden.de
|
||||
|
||||
|
||||
Anderthalb Hinweise zur Benutzung
|
||||
-----------------------------------
|
||||
|
||||
Das Theme ist noch nicht ganz fertig, an einigen Stellen wird noch gehobelt.
|
||||
|
||||
In Beiträgen mögt ihr bitte erst Überschriften ab 3. Ordnung verwenden,
|
||||
die erster Ordnung sind für den Header und die zweiter Ordnung sind für
|
||||
die Titel der Beiträge. Es gibt dafür auch fette Hinweise beim Bearbeiten.
|
||||
|
||||
|
||||
Eine kleine Änderungshistorie
|
||||
-------------------------------
|
||||
|
||||
v1.0 - TODO
|
||||
- Das Abschalten des Posterbilds für ist Seiten und Beiträge ohne Bild möglich.
|
||||
- Beitragsarten und deren unterschiedliche Darstellung ist auch für Seiten verfügbar.
|
||||
- Schmale Beitragsbilder (<1300px Breite) zerlegen das Layout nicht mehr.
|
||||
- Login-Formular im Widgetbereich unterstützen.
|
||||
|
||||
v0.99.7 - 21.09.2015
|
||||
- Safari bricht jetzt Artikelauflistungen richtig um. Die anderen machen es auch etwas besser.
|
||||
- Safari zeigt jetzt Suchfelder richtig an.
|
||||
- Safari malt die Trennline in der Navigation nicht mehr zu dick.
|
||||
- Wenn das Ajax-Login-Formular benutzt wird, verschwindet das Hamburgermenü nicht mehr.
|
||||
|
||||
v0.99.6 - 19.09.2015
|
||||
- Weitere Blau- und Gelbtöne einheitlich umgesetzt, v.a. im Editor.
|
||||
- Update für Milu: Zusatz „Kategorie“ wird im Titel auf abendlager.pfadfinden.de nicht mehr angezeigt.
|
||||
- Der linke Rand wird jetzt immer eingehalten, egal wie lang der Navigationsbereich ist.
|
||||
- Anpassung an WordPress 4.3: Favicon kommt nur aus dem Theme, wenn kein eigenes gesetzt ist.
|
||||
- Der Hinweis, dass Kommentare nicht möglich sind, wird standardmäßig ausgeblendet.
|
||||
- Links in der Navigation färben sich jetzt anhand der Hierarchie im Menü ein, nicht derer der Seiten.
|
||||
|
||||
v0.99.5 - 19.08.2015
|
||||
- Seitentitel beschreiben jetzt besser, was tatsächlich angezeigt wird.
|
||||
- Farben aus dem Handbuch einheitlich umgesetzt.
|
||||
|
||||
v0.99.4 - 13.08.2015
|
||||
- Das Menü wird automatisch wieder eingeblendet, wenn die Fensterbreite über 720px steigt.
|
||||
- Fehlerkorrektur: Es werden keine Urls mehr unter dem Editorfeld ausgegeben.
|
||||
- Das Theme ist nicht mehr auf das Plugin angewiesen. Die benötigte Bilbiothek shy-wordpress wird direkt mitgeliefert.
|
||||
|
||||
v0.99.3 - 01.08.2015
|
||||
- Der Editor sollte jetzt in den meisten Fällen eine realistische Vorschau bieten.
|
||||
- Überschriften sind jetzt blau auf gelb.
|
||||
Überschriften erster und zweiter Ordnung in Beiträgen und Seiten werden durch Überschriften dritter Ordnung ersetzt.
|
||||
- Schrift „Immenhausen“ durch verbesserte Variante ausgetauscht.
|
||||
- Kleinere Korrekturen an Abständen.
|
||||
|
||||
v0.99.2 - 27.07.2015
|
||||
- Kleinere Textanpassungen.
|
||||
|
||||
v0.99.1 - 27.07.2015
|
||||
- Auf großen Displays wird das Beitragsbild nicht mehr verzerrt.
|
||||
|
||||
v0.99 - 26.07.2015
|
||||
- Erster Kandidat zur Veröffentlichung als Version 1.0.
|
||||
- Die Überschriften erstrahlen in vollem Glanz.
|
||||
- Kommentare sehen besser aus.
|
||||
- Das Theme ist responsive bis runter auf 300px.
|
||||
- Fußleiste überarbeitet und zweigeteilt.
|
||||
|
||||
v0.9.1 - 07.07.2015
|
||||
- Fehlerkorrektur: Der Titel wird nicht mehr doppelt angezeigt.
|
||||
|
||||
v0.9 - 03.07.2015
|
||||
- Kommentare werden jetzt angezeigt.
|
||||
- Etwas mehr responsive: Mindestbreite 700px für ordentliche Anzeige.
|
||||
|
||||
v0.8 - 21.06.2015
|
||||
- Standardwidgets sehen jetzt in der Leiste gut aus.
|
||||
- Die Fußzeile sitzt jetzt fester an ihrem Platz.
|
||||
|
||||
v0.7 - 18.06.2015
|
||||
- Große Posterbilder hinzugefügt, die auch auf der Bundeswebseite zu sehen sind.
|
||||
- Erhebliche Verbesserungen der Darstellung.
|
||||
|
||||
v0.6 - 16.06.2015
|
||||
- Mehr Unterstützung für HTML5.
|
||||
|
||||
v0.5 - 16.06.2015
|
||||
- Fehler behoben, der die WordPress-Installation unbrauchbar machen könnte.
|
||||
|
||||
v0.4 - 11.06.2015
|
||||
- Navigation überarbeitet.
|
||||
|
||||
v0.3 - 10.06.2015
|
||||
- Webfont Immenhausen für Überschriften.
|
||||
|
||||
v0.2 - 04.06.2015
|
||||
- Grafiken eingebaut.
|
||||
|
||||
v0.1 - 20.04.2015
|
||||
- Erste Veröffentlichung.
|
Before Width: | Height: | Size: 336 KiB |
@ -1,11 +0,0 @@
|
||||
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
|
||||
<label>
|
||||
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ); ?></span>
|
||||
<?php if ( doing_action( 'buena_search_form' ) ): ?>
|
||||
<input type="search" class="search-field" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ); ?>" />
|
||||
<?php else: ?>
|
||||
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ); ?>" />
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
<button type="submit" class="search-submit" title="<?php esc_attr_e( 'Query search', 'buena-theme' ); ?>"><?php echo esc_html_x( 'Search', 'submit button' ); ?></button>
|
||||
</form>
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Pfadfinden\WordPress;
|
||||
|
||||
use Shy\WordPress\CompositeOption;
|
||||
|
||||
|
||||
|
||||
class BuenaSettings extends CompositeOption
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct( 'buena-theme' );
|
||||
}
|
||||
|
||||
public function getDefaults()
|
||||
{
|
||||
return [
|
||||
'use_cdn' => false,
|
||||
'always_show_poster' => true,
|
||||
];
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Pfadfinden\WordPress;
|
||||
|
||||
use Shy\WordPress\Administration\SettingsPage;
|
||||
use Shy\WordPress\Administration\CheckboxField;
|
||||
|
||||
|
||||
|
||||
class BuenaSettingsPage extends SettingsPage
|
||||
{
|
||||
public function getFields()
|
||||
{
|
||||
$this->addSection( '', 'buena' );
|
||||
|
||||
return array(
|
||||
'use_cdn' => new CheckboxField(),
|
||||
'always_show_poster' => new CheckboxField(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getParentSlug()
|
||||
{
|
||||
return 'themes.php';
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return __( 'Buena-Einstellungen', 'buena-theme' );
|
||||
}
|
||||
}
|
@ -1,317 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Pfadfinden\WordPress;
|
||||
|
||||
use Shy\WordPress\Theme;
|
||||
|
||||
|
||||
|
||||
class BuenaTheme extends Theme
|
||||
{
|
||||
/**
|
||||
* @var BuenaSettings
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
|
||||
public function getContentWidth()
|
||||
{
|
||||
return 684;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->settings = new BuenaSettings();
|
||||
|
||||
$this->addHookMethod( 'after_setup_theme', 'afterSetupTheme' );
|
||||
$this->addHookMethod( 'wp_enqueue_scripts', 'enqueueScriptsStyles' );
|
||||
|
||||
$this->addHookMethod( 'buena_search_form', 'printSearchForm' );
|
||||
|
||||
$this->addHookMethod( 'admin_init', 'initAdministration' );
|
||||
$this->addHookMethod( 'mce_css', 'filterEditorStylesheets' );
|
||||
|
||||
$this->addHookMethod( 'wp_page_menu', 'filterPageMenu' );
|
||||
$this->addHookMethod( 'widgets_init', 'registerSidebars' );
|
||||
|
||||
$this->addHookMethod( 'the_content', 'filterContent' );
|
||||
|
||||
$this->addHookMethod( 'image_size_names_choose', 'filterImageSizeNames' );
|
||||
$this->addHookMethod( 'media_upload_tabs', 'filterMediaTabs' );
|
||||
$this->addHookMethod( 'media_view_settings', 'filterMediaViewSettings' );
|
||||
$this->addHookMethod( 'media_view_strings', 'filterMediaViewSettings' );
|
||||
$this->addHookMethod( 'print_media_templates', 'printMediaTemplates' );
|
||||
}
|
||||
|
||||
|
||||
public function afterSetupTheme()
|
||||
{
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
|
||||
register_nav_menu( 'primary', __( 'Hauptmenü', 'buena-theme' ) );
|
||||
register_nav_menu( 'footer', __( 'Fußzeile', 'buena-theme' ) );
|
||||
|
||||
add_theme_support( 'html5', [
|
||||
'comment-list', 'comment-form', 'search-form', 'gallery', 'caption',
|
||||
] );
|
||||
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
$custom_header = [
|
||||
'width' => apply_filters( 'buena_header_image_width', 1300 ),
|
||||
'height' => apply_filters( 'buena_header_image_height', 635 ),
|
||||
'flex-width' => true,
|
||||
'flex-height' => true,
|
||||
'default-image' => get_template_directory_uri() . '/img/leitbild_aktionen_low.jpg',
|
||||
'uploads' => true,
|
||||
'header-text' => false,
|
||||
];
|
||||
add_theme_support( 'custom-header', $custom_header );
|
||||
set_post_thumbnail_size( $custom_header['width'], $custom_header['height'], true );
|
||||
|
||||
add_image_size( 'gallery-thumb', 350, 165, true );
|
||||
|
||||
register_default_headers( [
|
||||
'aktionen' => [
|
||||
'url' => '%s/img/leitbild_aktionen_low.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_aktionen_low_klein.jpg',
|
||||
'description' => __( 'Leitbild Aktionen', 'buena-theme' ),
|
||||
],
|
||||
'bund' => [
|
||||
'url' => '%s/img/leitbild_bund_crop.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_bund_crop_klein.jpg',
|
||||
'description' => __( 'Leitbild Bund', 'buena-theme' ),
|
||||
],
|
||||
'ihs' => [
|
||||
'url' => '%s/img/leitbild_ihs.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_ihs_klein.jpg',
|
||||
'description' => __( 'Leitbild Immenhausen', 'buena-theme' ),
|
||||
],
|
||||
'international' => [
|
||||
'url' => '%s/img/leitbild_int2_low.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_int2_low_klein.jpg',
|
||||
'description' => __( 'Leitbild International', 'buena-theme' ),
|
||||
],
|
||||
'kontakt' => [
|
||||
'url' => '%s/img/leitbild_Kontakt_low.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_Kontakt_low_klein.jpg',
|
||||
'description' => __( 'Leitbild Kontakt', 'buena-theme' ),
|
||||
],
|
||||
'pfadfinden' => [
|
||||
'url' => '%s/img/leitbild_pfadfinden_low.jpg',
|
||||
'thumbnail_url' => '%s/img/leitbild_pfadfinden_low_klein.jpg',
|
||||
'description' => __( 'Leitbild Pfadfinden', 'buena-theme' ),
|
||||
],
|
||||
] );
|
||||
}
|
||||
|
||||
public function getTeaserImage()
|
||||
{
|
||||
if ( is_page() || have_posts() && is_single() ) { // FIXME: is_singular()?
|
||||
the_post();
|
||||
$thumb = get_the_post_thumbnail( null, 'post-thumbnail', [ 'alt' => '' ] );
|
||||
rewind_posts();
|
||||
|
||||
if ( $thumb ) {
|
||||
return $thumb;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_home() || $this->settings['always_show_poster'] ) {
|
||||
return sprintf(
|
||||
'<img src="%s" height="%d" width="%d" alt="" />',
|
||||
get_header_image(),
|
||||
get_custom_header()->height,
|
||||
get_custom_header()->width
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt einen Titel für die aktuelle Seite aus.
|
||||
*/
|
||||
public function printTitle()
|
||||
{
|
||||
if ( is_singular() ) {
|
||||
the_title();
|
||||
} elseif ( is_category() && strpos( $_SERVER['HTTP_HOST'], 'abendlager.pfadfinden.de' ) !== false ) {
|
||||
// FIXME: Workaround mit 1.0 entfernen.
|
||||
single_cat_title( '', true );
|
||||
} elseif ( is_archive() ) {
|
||||
the_archive_title();
|
||||
} elseif ( is_search() ) {
|
||||
esc_html_e( sprintf(
|
||||
__( 'Suche nach „%s“', 'buena-theme' ),
|
||||
get_search_query( false )
|
||||
) );
|
||||
} else {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueueScriptsStyles()
|
||||
{
|
||||
wp_enqueue_style( 'immenhausen-font', get_template_directory_uri() . '/font/ihs.css' );
|
||||
wp_enqueue_style( 'buena-style', get_stylesheet_uri() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt das Suchformular aus. Nötig, damit im Kopf anderer Code stehen kann als anderswo.
|
||||
*/
|
||||
public function printSearchForm()
|
||||
{
|
||||
get_search_form( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tut, was dransteht.
|
||||
*/
|
||||
public function registerSidebars()
|
||||
{
|
||||
register_sidebar( [
|
||||
'id' => 'below-navigation',
|
||||
'name' => __( 'Unter Navigation', 'buena-theme' ),
|
||||
'description' => __( 'Ziemlich schmal.', 'buena-theme' ),
|
||||
'before_title' => '<h4 class="h-widget">',
|
||||
'after_title' => '</h4>',
|
||||
] );
|
||||
register_sidebar( [
|
||||
'id' => 'footer',
|
||||
'name' => __( 'Fußleiste', 'buena-theme' ),
|
||||
'description' => __( 'Rechte Spalte des Briefumschlags. Recht flach. Füllt die ganze Breite aus, wenn kein Navigationsmenü zugewiesen ist.', 'buena-theme' ),
|
||||
'before_title' => '<h4 class="h-widget">',
|
||||
'after_title' => '</h4>',
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ausgabe von wp_page_menu() filtern, dass sie wie wp_nav_menu() aussieht.
|
||||
*
|
||||
* @param string $menu
|
||||
* @param array $args
|
||||
* @return string
|
||||
*/
|
||||
public function filterPageMenu( $menu, array $args )
|
||||
{
|
||||
if ( ! isset( $args['fallback_cb'] ) || $args['fallback_cb'] !== 'wp_page_menu' ) {
|
||||
return $menu;
|
||||
}
|
||||
|
||||
$vorher = '<div class="' . esc_attr( $args['menu_class'] ) . '">';
|
||||
|
||||
$danach = '<' . $args['container'];
|
||||
if ( $args['container_class'] ) {
|
||||
// In diesem Fall doch optional…
|
||||
$danach .= ' class="' . esc_attr( $args['container_class'] ) . '"';
|
||||
}
|
||||
if ( $args['container_id'] ) {
|
||||
$danach .= ' id="' . esc_attr( $args['container_id'] ) . '"';
|
||||
}
|
||||
$danach .= '>';
|
||||
|
||||
if ( strpos( $menu, '<ul>' ) !== false ) {
|
||||
// Wenn das Menü leer ist, enthält es den <ul>-Teil nicht.
|
||||
$vorher .= '<ul>';
|
||||
$danach .= '<ul class="' . esc_attr( $args['menu_class'] ) . '">';
|
||||
}
|
||||
|
||||
$menu = str_replace( $vorher, $danach, $menu );
|
||||
$menu = substr( $menu, 0, -5 ) . $args['container'] . ">\n";
|
||||
|
||||
$menu = str_replace( "class='children'", 'class="sub-menu"', $menu );
|
||||
$menu = str_replace( 'current_page_item', 'current_page_item current-menu-item', $menu );
|
||||
$menu = str_replace( 'current_page_ancestor', 'current_page_ancestor current-menu-ancestor', $menu );
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zusatzfunktionen für das Backend laden.
|
||||
*/
|
||||
public function initAdministration()
|
||||
{
|
||||
if ( isset( $_GET['exp'] ) && class_exists( 'Pfadfinden\WordPress\BuenaSettingsPage' ) ) {
|
||||
new BuenaSettingsPage( $this->settings );
|
||||
}
|
||||
|
||||
add_editor_style();
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard-Skin des Editors rauswerfen.
|
||||
*
|
||||
* @param string $stylesheets
|
||||
* @return string
|
||||
*/
|
||||
public function filterEditorStylesheets( $stylesheets )
|
||||
{
|
||||
$stylesheets = explode( ',', $stylesheets );
|
||||
$stylesheets = array_filter( $stylesheets, function ( $url ) {
|
||||
return strpos( $url, 'tinymce' ) === false;
|
||||
} );
|
||||
|
||||
return implode( ',', $stylesheets );
|
||||
}
|
||||
|
||||
/**
|
||||
* Überschriften <h1> und <h2> durch <h3> ersetzen.
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public function filterContent( $content )
|
||||
{
|
||||
$content = preg_replace( '/\\<h[12]([^>]*)>(.*?)\\<\\/h[12]>/', '<h3$1>$2</h3>', $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $names
|
||||
* @return array
|
||||
*/
|
||||
public function filterImageSizeNames( array $names )
|
||||
{
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tabs
|
||||
* @return array
|
||||
*/
|
||||
public function filterMediaTabs( $tabs )
|
||||
{
|
||||
return $tabs;
|
||||
return $tabs + [
|
||||
'insert-poster' => __( 'Posterbilder', 'buena-theme' ),
|
||||
];
|
||||
// Erzeugt einen <iframe> von wp-admin/media-upload.php?chromeless=1&post_id=123456&tab=insert-poster
|
||||
}
|
||||
|
||||
public function filterMediaViewSettings( $settings )
|
||||
{
|
||||
//var_dump( $settings );
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Weitere Templates für Medienbrowser ausgeben.
|
||||
*/
|
||||
public function printMediaTemplates()
|
||||
{
|
||||
global $_wp_default_headers;
|
||||
?>
|
||||
<script type="text/html" id="tmpl-insert-poster">
|
||||
<ul>
|
||||
<?php foreach ( $_wp_default_headers as $k => $header ) : ?>
|
||||
<img alt="<?php esc_attr_e( $header['description'] ); ?>" src="<?php echo esc_url( sprintf( $header['thumbnail_url'], get_template_directory_uri() ) ); ?>" />
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Try to load a Pfadfinden WordPress class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
function buena_autoloader( $name )
|
||||
{
|
||||
if ( substr( $name, 0, 21 ) !== 'Pfadfinden\\WordPress\\' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = __DIR__ . '/' . str_replace( '\\', DIRECTORY_SEPARATOR, $name ) . '.php';
|
||||
return is_file( $name ) && include( $name );
|
||||
}
|
||||
|
||||
spl_autoload_register( 'buena_autoloader' );
|
250
buena/style.css
@ -1,250 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/**
|
||||
Theme Name: Buena
|
||||
Version: 0.99.7
|
||||
Theme URI: http://lab.hanseaten-bremen.de/themes/buena/
|
||||
Author: Philipp Cordes <philipp.cordes@pfadfinden.de>
|
||||
Description: Das neue Corporate Design, jetzt auch für WordPress.
|
||||
License: Proprietary
|
||||
Tags: one-column, three-columns, responsive-layout, automatic-feed-links, post-thumbnails, featured-images, custom-menu, blue, white, yellow, editor-style
|
||||
*/
|
||||
|
||||
/*
|
||||
Farben:
|
||||
- gelb: #ffcb04 (Handbuch, manchmal T3), #ffca28 (T3)
|
||||
- Verlauf: #9f7515 bis #e1af22, #e0cb84 bis #fff (IE-Fallback)
|
||||
- blass: #fff5d9 (T3-Zebra)
|
||||
- blau: #1d4899 (Handbuch, manchmal T3), #0d52a5 (T3)
|
||||
- Markierung (T3): #b3d4fc
|
||||
*/
|
||||
|
||||
html, body { border: 0 none; padding: 0; margin: 0; min-height: 100%; position: static; }
|
||||
html { font-family: Sans-Serif; font-size: 81.3%; background: url("img/holz.jpg") #dbb97b; position: relative; }
|
||||
header, hgroup, nav, footer, article { display: block; }
|
||||
.h, h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { margin: 0; font-family: IHS, Serif; font-size: 1em; font-weight: normal; font-style: normal; }
|
||||
button, input, select, optgroup, option { margin: 0; font: inherit; color: inherit; }
|
||||
button, input[type="button"], input[type="submit"], input[type="reset"] { cursor: pointer; }
|
||||
input[type="search"] { -webkit-appearance: textfield; }
|
||||
p, ul, ol, dt { line-height: 1.5; }
|
||||
abbr { border-bottom: 1px dotted; }
|
||||
a { color: #1d4899; }
|
||||
figure, .wp-caption { margin: 0; max-width: 100%; }
|
||||
figcaption, .wp-caption-text { font-style: italic; padding: 0.5em 0; }
|
||||
.screen-reader-text { display: none; }
|
||||
.aligncenter { margin: 0 auto; }
|
||||
.alignleft { float: left; margin: 0 1em 0 0; }
|
||||
.alignright { float: right; margin: 0 0 0 1em; }
|
||||
|
||||
::-moz-selection { background: #1d4899; color: #ffcb04; text-shadow: none; outline: 2px solid #1d4899; }
|
||||
::selection { background: #1d4899; color: #ffcb04; text-shadow: none; outline: 2px solid #1d4899; }
|
||||
|
||||
/* Media object */
|
||||
.media { margin: 1em 0; }
|
||||
.media, .bd { overflow: hidden; _overflow: visible; }
|
||||
/*.media img { display: block; }*/
|
||||
/* Clearfix */
|
||||
.clearfix::after,
|
||||
.clearfix::before,
|
||||
.media::after,
|
||||
.media::before { content: " "; display: table; }
|
||||
.clearfix::after,
|
||||
.media::after { clear: both; }
|
||||
|
||||
/* Layout */
|
||||
#wrap { background: url("img/klufthemd.png") no-repeat; padding: 0 0 2em; }
|
||||
#footer { background: url("img/loeffel-topf.png") no-repeat 100% 100%; position: absolute; width: 100%; bottom: 0; }
|
||||
#footer .wrapper { background: url("img/briefumschlag.png") no-repeat; margin: 0 0 0 240px; padding: 112px 7px 0 21px; height: 286px; width: 700px; box-sizing: border-box; }
|
||||
#footer header { color: #ffcb04; text-align: center; font-size: 25px; margin: -111px 0 13px; line-height: 111px; }
|
||||
#footer .widgets { padding: 0 2em 0 0; }
|
||||
|
||||
#left { margin: -18px -200px 0 40px; width: 160px; z-index: 30; float: left; position: relative; }
|
||||
#main { overflow: hidden; padding: 0 0 286px 240px; }
|
||||
@media (max-width: 960px) {
|
||||
/* Umschlag unter die Navigation umbrechen */
|
||||
#left { margin-bottom: 300px; }
|
||||
#footer .wrapper { margin-left: 0; }
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
#main { padding-left: 0; }
|
||||
#left { margin-right: 0; }
|
||||
}
|
||||
|
||||
/* FIXME: Positionierung des Schattens weiter vereinfachen, auch Untertitel verlinken. */
|
||||
/* FIXME: Branding umbenennen, siehe https://github.com/pfadfinden/wordpress-theme-updater/issues/13 */
|
||||
#branding { min-height: 145px; padding: 0 33px 20px 240px; text-align: center; position: relative; width: 425px; margin-bottom: -27px; }
|
||||
#branding::after { content: ""; display: block; position: absolute; bottom: 0; right: 0; z-index: 15; height: 143px; width: 457px; background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIGhlaWdodD0nMzAwJyB3aWR0aD0nNDcwJyB2aWV3Qm94PScwIDAgMzAwIDQyNScgcHJlc2VydmVBc3BlY3RSYXRpbz0neE1pbllNaW4gbWVldCc+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSd2JyB4MT0nMCcgeTE9JzAnIHgyPScwJyB5Mj0nMTQwJSc+PHN0b3Agb2Zmc2V0PScwJyBzdG9wLWNvbG9yPScjMDAwJyBzdG9wLW9wYWNpdHk9JzAuNycgLz48c3RvcCBvZmZzZXQ9JzUwJScgc3RvcC1jb2xvcj0nIzAwMCcgc3RvcC1vcGFjaXR5PScwLjQnIC8+PHN0b3Agb2Zmc2V0PSc4MCUnIHN0b3AtY29sb3I9JyMwMDAnIHN0b3Atb3BhY2l0eT0nMC4xJyAvPjxzdG9wIG9mZnNldD0nMTAwJScgc3RvcC1jb2xvcj0iIzAwMCIgc3RvcC1vcGFjaXR5PScwJyAvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxwYXRoIGQ9J00xMCwyMDAgQzE1MCwxNzAgNDUwLDE4MCA2MTUsMTkwIEw2MDgsMDAgTDE1LDAgWicgc3R5bGU9J3N0cm9rZTpub25lOycgZmlsbD0ndXJsKCN2KSc+PC9wYXRoPjwvc3ZnPg0K") no-repeat 50% 0; }
|
||||
#branding > * { margin: 0; position: relative; z-index: 20; }
|
||||
.site-title { font-size: 20px; background: #ffcb04; color: #0d53a5; margin-top: auto; line-height: 115px; }
|
||||
.site-title a { display: block; vertical-align: bottom; }
|
||||
.site-title img { vertical-align: bottom; padding-bottom: 16px; }
|
||||
.site-description { font-size: 18px; background: #0d53a5; color: #ffcb04; line-height: 30px; font-family: IHS, Serif; letter-spacing: 1px; word-spacing: 2px; }
|
||||
|
||||
#header .search-form { background: url("img/streichholzschachtel.png") no-repeat; position: absolute; height: 89px; left: 750px; top: 1.5em; width: 98px; padding: 25px 47px 0 35px; }
|
||||
#header .search-form label { display: block; position: relative; margin: 25px 0 -50px; text-align: left; }
|
||||
#header .search-field { background: transparent; border: 2px solid #ffcb04; padding: 2px; color: #fff; display: block; max-width: 100%; box-sizing: border-box; }
|
||||
#header .search-submit { background: transparent; color: #ffcb04; border: 0 none; font-family: IHS, Serif; font-size: 1.4em; padding: 0; display: block; box-sizing: border-box; }
|
||||
#header > nav { position: absolute; top: 0; right: 0; z-index: 9999; display: none; }/* FIXME: Workaround Branding-Doppelung */
|
||||
#responsiveMenu { border: 0 none; background: transparent; height: 51px; margin: 1em; }
|
||||
@media (max-width: 960px) { /* Suche ausblenden */
|
||||
#header .search-form { display: none; }
|
||||
}
|
||||
|
||||
.nav-menu ul { list-style: none; padding: 0; margin: 0; }
|
||||
.nav-menu-primary > ul { font-family: IHS, Serif; }
|
||||
.nav-menu-primary > ul > .current-menu-ancestor,
|
||||
.nav-menu-primary > ul > .current-menu-item { background: #e1af22 no-repeat; background-image: linear-gradient(#9f7515 0%, #e1af22 100%); border-bottom: 1px solid #9f7515; border-top: 1px solid #9f7515; margin: 0.5em 0; padding: 0.5em 0; }
|
||||
.nav-menu-primary .sub-menu { display: none; }
|
||||
.nav-menu-primary a { padding: 0.4em 0.5em 0.4em 1em; display: block; text-decoration: none; color: #6b5742; font-size: 1.4em; }
|
||||
.nav-menu-primary li ul a { font-family: Georgia, Serif; font-size: 12px; font-style: italic; padding: 5px 5px 5px 25px; color: #000; }
|
||||
.nav-menu-primary .current-menu-ancestor .sub-menu,
|
||||
.nav-menu-primary .current-menu-item .sub-menu { display: block; }
|
||||
.nav-menu-primary .current-menu-ancestor a { color: #000; }
|
||||
.nav-menu-primary .current-menu-item > a { color: #fff; }
|
||||
.nav-menu-primary a:hover,
|
||||
.nav-menu-primary a:focus { color: #000; }
|
||||
.nav-menu .current-menu-ancestor a:hover,
|
||||
.nav-menu .current-menu-ancestor a:focus,
|
||||
.nav-menu .sub-menu a:hover,
|
||||
.nav-menu .sub-menu a:focus,
|
||||
.nav-menu-footer a:hover,
|
||||
.nav-menu-footer a:focus { text-decoration: underline; }
|
||||
.nav-menu-footer { font-family: Georgia, Serif; font-style: italic; padding-left: 2em; }
|
||||
.nav-menu-footer > ul { width: 323px; height: 174px; position: relative; display: flex; -webkit-flex-flow: column; flex-flow: column; -webkit-justify-content: center; justify-content: center; -webkit-align-items: stretch; align-items: stretch; }
|
||||
.nav-menu-footer li { margin-bottom: 0.75em; }
|
||||
.nav-menu-footer a { padding: 4px 4px 4px 25px; text-decoration: none; }
|
||||
|
||||
.widget_recent_entries > ul,
|
||||
.widget_recent_comments > ul,
|
||||
.widget_archive > ul,
|
||||
.widget_categories > ul,
|
||||
.widget_meta > ul { list-style: none; padding: 0; margin: 0; }
|
||||
|
||||
#left > .nav-menu { background: #ffcb04; color: #6b5742; padding: 10px 0 2em; }
|
||||
#left > .widgets { background: rgba(56, 46, 35, 0.7); color: #ffcb04; padding: 1em 15px 15px 20px; font-size: 13px; font-style: italic; }
|
||||
#left > .widgets a { color: #fff; text-decoration: none; }
|
||||
#left > .widgets a:hover,
|
||||
#left > .widgets a:focus { text-decoration: underline; }
|
||||
|
||||
/* Widgets: Basisdarstellung */
|
||||
.widgets { list-style: none; padding: 0; margin: 0; font-family: Georgia, Serif; font-style: italic; }
|
||||
.widget_calendar table { text-align: center; }
|
||||
|
||||
/* Widgets: Korrekturen für unsere Seitenleiste */
|
||||
#left .widget_search form { display: flex; }
|
||||
#left .widget_search form > * { border: 2px solid #ffcb04; }
|
||||
#left .widget_search input { box-sizing: border-box; width: 100%; border: 0 none; background: transparent; color: #fff; text-align: center; padding: 3px 0.25em 4px; }
|
||||
#left .widget_search button { color: transparent; background: url("res/lupe.svg") 50% 50% no-repeat #ffcb04; width: 31px; }
|
||||
|
||||
#left .widget_calendar > div { margin: 0 -15px 0 -20px; }
|
||||
#left .widget_calendar > div > table { text-align: center; margin: 0 auto; }
|
||||
|
||||
#left .widget_pages ul { padding-left: 2em; }
|
||||
#left .widget_pages > ul { list-style: none; padding: 0; }
|
||||
|
||||
#left > .widgets .widget { margin: 0; padding: 1em 0; }
|
||||
.widgets .h-widget { color: #ffcb04; font-size: 16px; }
|
||||
#left > .widgets .menu,
|
||||
.widgets .widget_categories ul { list-style: none; padding: 0; }
|
||||
|
||||
/* Überschriften mit Bild darunter */
|
||||
.h-box { position: relative; display: block; margin-bottom: 1em; text-decoration: none; }
|
||||
.h-box > img { position: absolute; top: 0; left: 0; height: 100%; width: 100%; }
|
||||
.h-box > .wrap { position: absolute; max-width: 100%; left: 0; }
|
||||
.h-box > .wrap > * { display: inline; -o-box-decoration-break: clone; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
|
||||
|
||||
.h-box-teaser { box-shadow: 0 5px 5px rgba(0, 0, 0, 0.3); line-height: 1; display: inline-block; width: 1300px; max-width: 100%; }
|
||||
.h-box-teaser > img { position: static; }
|
||||
.h-box-teaser > .wrap { bottom: 1em; padding-left: 240px; }
|
||||
.h-box-teaser > .wrap > * { background: rgba(56, 46, 35, 0.7); color: #ffcb04; padding: 2px 13px 4px; font-size: 52px; line-height: 78px; }
|
||||
@media (max-width: 720px) {
|
||||
.h-box-teaser { margin-top: 1em; margin-left: 0; }
|
||||
.h-box-teaser > .wrap { padding-left: 1em; }
|
||||
.h-box-teaser > .wrap > * { font-size: 2em; line-height: 39px; }
|
||||
}
|
||||
|
||||
.h-box-blaugelb { padding-top: 47.1428571%; }
|
||||
.h-box-blaugelb > .wrap { bottom: 0; font-size: 18px; }
|
||||
.h-box-blaugelb > .wrap > * { color: #1d4899; background: #ffcb04; padding: 3px 5px; line-height: 26px; }
|
||||
|
||||
.h-box-blaugelb-bildlos { padding: 0; }
|
||||
.h-box-blaugelb-bildlos > .wrap { position: static; }
|
||||
/**/
|
||||
|
||||
.container { max-width: 1020px; }
|
||||
.page .container,
|
||||
.single-post:not(.single-format-gallery) .container { max-width: 710px; }
|
||||
|
||||
.content-singular .format-gallery { background: transparent; padding: 0; margin: 0; position: relative; }
|
||||
.content-singular .format-gallery .gallery { display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-align-content: space-between; align-content: space-between; -webkit-align-items: flex-start; align-items: flex-start; }
|
||||
.content-singular .format-gallery .gallery-item { background: #fff; padding: 1em; margin: 0 1em 1em 0; }
|
||||
.gallery-columns-1 .gallery-item { flex: 1 0 50%; }
|
||||
.gallery-columns-2 .gallery-item { flex: 1 0 34%; }
|
||||
.gallery-columns-3 .gallery-item { flex: 1 0 25%; }
|
||||
.gallery-columns-4 .gallery-item { flex: 1 0 20%; }
|
||||
|
||||
.content-gallery { display: flex; position: relative; z-index: 10; -webkit-flex-wrap: wrap; flex-wrap: wrap; overflow: hidden; }
|
||||
.container article,
|
||||
.commentlist article,
|
||||
.comment-form { padding: 1em; margin: 0 1em 1em 0; transition: width 0.5s, height 0.5s; box-sizing: border-box; }
|
||||
.container article > :first-child,
|
||||
.comment-form > :first-child { margin-top: 0; }
|
||||
.container article > :last-child,
|
||||
.comment-form > .form-submit { margin-bottom: 0; }
|
||||
.content-singular > article:not(.format-gallery),
|
||||
.content-gallery > article,
|
||||
.commentlist article,
|
||||
.comment-form { min-width: 20em; background: #fff; box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1); }
|
||||
.content-gallery > article { flex: 1 1 25%; max-width: calc(33.333% - 1em); }
|
||||
@media (max-width: 1070px) { .content-gallery > article { flex: 1 1 34%; max-width: calc(50% - 1em); } }
|
||||
@media (max-width: 800px) { .content-gallery > article { flex: 1 1 50%; max-width: 100%; } }
|
||||
.container > .pagination { margin-right: 1em; }
|
||||
|
||||
/* WordPress-Wünsche */
|
||||
.sticky {}
|
||||
|
||||
img { max-width: 100%; height: auto; border: 0 none; vertical-align: middle; }
|
||||
ul, ol { padding-left: 2em; }
|
||||
dl, ul, ol, h1, h2, h3, h4, h5, h6, blockquote, p, table { margin: 0.5em 0; }
|
||||
dd, li > ol, li > ul { margin: 0; }
|
||||
dt { font-weight: bold; }
|
||||
blockquote, dd { padding-left: 2em; }
|
||||
article > p:empty:last-child { margin: -0.5em 0 0.5em; }
|
||||
article h3, article .h3, article h4, article .h4, article h5, article .h5, article h6, article .h6 { display: inline-block; background: #ffcb04; color: #1d4899; margin-bottom: 0; padding: 2px 4px; }
|
||||
article h3, article .h3 { font-size: 18px; padding: 3px 5px; }
|
||||
article h4, article .h4 { font-size: 16px; }
|
||||
article h5, article .h5 { font-size: 14px; }
|
||||
.gallery-caption {}
|
||||
.bypostauthor {}
|
||||
.twitter-tweet {}
|
||||
|
||||
/* Kommentare */
|
||||
#comments, #reply-title { font-size: 2.5em; color: #fff; margin: 0.5em 0 0.25em; }
|
||||
.commentlist { list-style: none; padding: 0; }
|
||||
.commentlist .children { list-style: none; padding-left: 1em; }
|
||||
.comment-form > p > * { vertical-align: top; }
|
||||
.comment-form > p > label::after { content: ": "; }
|
||||
.comment-body { position: relative; }
|
||||
.comment-metadata { position: absolute; top: 1em; right: 1em; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-justify-content: flex-end; justify-content: flex-end; }
|
||||
.comment-form textarea { resize: vertical; display: block; box-sizing: border-box; width: 100%; }
|
||||
|
||||
/* Responsive: Der komplizierte Kram. Hurra! */
|
||||
@media (max-width: 720px) { /* Gestapelt anordnen */
|
||||
#main { padding-bottom: 0; }
|
||||
#wrap, #footer .wrapper { background-image: none; }
|
||||
#branding { text-align: left; width: auto; padding: 0; margin: 0; min-height: 0; }
|
||||
#branding::after { display: none; background-image: none; }
|
||||
#branding h1 { line-height: 51px; }
|
||||
#branding h2 { padding: 0 1em; }
|
||||
.site-title a { display: inline-block; }
|
||||
.site-title img { height: 51px; width: auto; padding: 13px; }
|
||||
#header > nav { display: block; }
|
||||
#left { float: none; transition: 0.5s height; margin: 0; width: auto; }
|
||||
#left, #left .widgets { display: none; }
|
||||
.show-responsive-menu #left { display: block; }
|
||||
#content, .comments { margin-left: 1em; }
|
||||
#footer { background: #c4a164; position: static; }
|
||||
#footer .wrapper { padding: 1em; height: auto; width: auto; }
|
||||
#footer header { color: #000; margin: 0; line-height: 1.5; }
|
||||
.nav-menu-footer, #footer .widgets { float: none; margin: 1em 0 0; padding: 1em; }
|
||||
.nav-menu-footer > ul { height: auto; }
|
||||
}
|
7
buena/use/shy-wordpress/.gitignore
vendored
@ -1,7 +0,0 @@
|
||||
# Eclipse project files
|
||||
.buildpath
|
||||
.project
|
||||
.settings
|
||||
|
||||
# Local PHPUnit configuration
|
||||
phpunit.xml
|
@ -1,7 +0,0 @@
|
||||
<phpunit boostrap="tests/bootstrap.php">
|
||||
<testsuites>
|
||||
<testsuite>
|
||||
<directory suffix="Test.php" phpVersion="5.4.0">tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A composite option with a fixed number of suboptions and their default values.
|
||||
*/
|
||||
abstract class CompositeOption implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
{
|
||||
use HookableTrait;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
|
||||
protected function __construct( $slug )
|
||||
{
|
||||
$this->slug = (string) $slug;
|
||||
|
||||
$this->addHookMethod( 'default_option_' . $this->slug, 'getDefaults' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return default values for all suboptions.
|
||||
* Hooked into get_option() defaults.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getDefaults();
|
||||
|
||||
/**
|
||||
* @param string $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDefault( $offset )
|
||||
{
|
||||
return $this->getDefaults()[ $offset ];
|
||||
}
|
||||
|
||||
|
||||
public function offsetExists( $offset )
|
||||
{
|
||||
$settings = get_option( $this->slug );
|
||||
return isset( $settings[ $offset ] );
|
||||
}
|
||||
|
||||
public function offsetGet( $offset )
|
||||
{
|
||||
$settings = get_option( $this->slug );
|
||||
if ( ! isset( $settings[ $offset ] ) ) {
|
||||
throw new \OutOfBoundsException( "There is no setting '$offset'." );
|
||||
}
|
||||
|
||||
return $settings[ $offset ];
|
||||
}
|
||||
|
||||
public function offsetSet( $offset, $value )
|
||||
{
|
||||
$settings = get_option( $this->slug );
|
||||
if ( ! isset( $settings[ $offset ] ) ) {
|
||||
throw new \OutOfBoundsException( "There is no setting '$offset'." );
|
||||
}
|
||||
|
||||
$settings[ $offset ] = $value;
|
||||
update_option( $this->slug, $settings );
|
||||
}
|
||||
|
||||
public function offsetUnset( $offset )
|
||||
{
|
||||
throw new \BadMethodCallException( 'You cannot unset settings.' );
|
||||
}
|
||||
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count( $this->getDefaults() );
|
||||
}
|
||||
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator( get_option( $this->slug ) );
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Making actions and filters how they should be.
|
||||
*
|
||||
* Default to pass all arguments.
|
||||
*/
|
||||
trait HookableTrait
|
||||
{
|
||||
/**
|
||||
* @param string $action_or_filter
|
||||
* @param string $method
|
||||
* @param int $priority
|
||||
* @param int $acceptedArgs
|
||||
*/
|
||||
protected function addHookMethod( $action_or_filter, $method, $priority = 10, $acceptedArgs = 99 )
|
||||
{
|
||||
add_filter( $action_or_filter, array( $this, $method ), $priority, $acceptedArgs );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $action_or_filter
|
||||
* @param string $method
|
||||
* @param int $priority
|
||||
* @param int $acceptedArgs
|
||||
*/
|
||||
protected function removeHookMethod( $action_or_filter, $method, $priority = 10, $acceptedArgs = 99 )
|
||||
{
|
||||
remove_filter( $action_or_filter, array( $this, $method ), $priority, $acceptedArgs );
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Marker class for WordPress plugins.
|
||||
*/
|
||||
abstract class Plugin
|
||||
{
|
||||
use HookableTrait;
|
||||
}
|
@ -1,383 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstracts common functionality and escaping for the Settings API.
|
||||
*
|
||||
* TODO: Check slug and field names for illegal characters.
|
||||
* TODO: Refactor to not extend but use CompositeOption
|
||||
*/
|
||||
abstract class SettingsPage extends CompositeOption
|
||||
{
|
||||
use HookableTrait;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $capability;
|
||||
|
||||
|
||||
/**
|
||||
* Slug (file name) of the parent menu entry.
|
||||
*
|
||||
* @see add_submenu_page() for suggestions.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getParentSlug()
|
||||
{
|
||||
return 'options-general.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Title for this setting page.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getPageTitle();
|
||||
|
||||
/**
|
||||
* String to show in the menu entry.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getMenuTitle()
|
||||
{
|
||||
return $this->getPageTitle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $slug Page slug
|
||||
* @param string $capability Required capability to view
|
||||
*/
|
||||
protected function __construct( $slug, $capability = 'manage_options' )
|
||||
{
|
||||
parent::__construct( $slug );
|
||||
|
||||
$this->capability = (string) $capability;
|
||||
|
||||
$this->addHookMethod( 'admin_menu', 'registerPage' );
|
||||
$this->addHookMethod( 'admin_init', 'registerSettings' );
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register our options page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerPage()
|
||||
{
|
||||
add_submenu_page(
|
||||
$this->getParentSlug(),
|
||||
$this->getPageTitle(),
|
||||
$this->getMenuTitle(),
|
||||
$this->capability,
|
||||
$this->slug,
|
||||
array( $this, 'renderPage' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the actual settings.
|
||||
* Override and use addSection() and add*Field() methods.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerSettings()
|
||||
{
|
||||
register_setting(
|
||||
$this->slug,
|
||||
$this->slug,
|
||||
array( $this, 'sanitizeOptions' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize option values after form submission.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
abstract public function sanitizeOptions( array $options );
|
||||
|
||||
|
||||
/**
|
||||
* Section to add fields to.
|
||||
*
|
||||
* Parameter default from add_settings_field().
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $currentSection = 'default';
|
||||
|
||||
/**
|
||||
* Add a new section and return its generated name.
|
||||
*
|
||||
* @param string $title optional, can be empty
|
||||
* @param string $name optional, will be generated if empty
|
||||
* @return string
|
||||
*/
|
||||
protected function addSection( $title = '', $name = '' )
|
||||
{
|
||||
$name = (string) $name;
|
||||
if ( ! strlen( $name ) ) {
|
||||
$name = $this->slug . '-section' . ( count( $this->getSections() ) + 1 );
|
||||
}
|
||||
|
||||
add_settings_section(
|
||||
$name,
|
||||
esc_html( $title ),
|
||||
array( $this, 'renderSectionTeaser' ),
|
||||
$this->slug
|
||||
);
|
||||
|
||||
return $this->currentSection = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback before output of section fields.
|
||||
*
|
||||
* Teasers must escape their output themselves.
|
||||
*
|
||||
* @param array $section {
|
||||
* @type string $id
|
||||
* @type string $title
|
||||
* @type callable $callback
|
||||
* }
|
||||
*/
|
||||
public function renderSectionTeaser( array $section )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all known section names on this page.
|
||||
*
|
||||
* @global $wp_settings_fields
|
||||
* @return array<string>
|
||||
*/
|
||||
public function getSections()
|
||||
{
|
||||
global $wp_settings_fields;
|
||||
|
||||
if ( ! isset( $wp_settings_fields[ $this->slug ] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return array_keys( $wp_settings_fields[ $this->slug ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @global $wp_settings_fields
|
||||
* @param string $section
|
||||
* @return array<string, array {
|
||||
* @type string $id
|
||||
* @type string $title
|
||||
* @type callable $callback
|
||||
* @type array $args
|
||||
* }>
|
||||
*/
|
||||
public function getFieldsForSection( $section )
|
||||
{
|
||||
global $wp_settings_fields;
|
||||
|
||||
return $wp_settings_fields[ $this->slug ][ $section ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom field to this setting page.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $label
|
||||
* @param callable $callback
|
||||
* @param array $args
|
||||
*/
|
||||
protected function addField( $name, $label, $callback, $args = array() )
|
||||
{
|
||||
if ( ! is_callable( $callback ) ) {
|
||||
throw new \InvalidArgumentException( 'Parameter $callback must be callable.' );
|
||||
}
|
||||
|
||||
add_settings_field(
|
||||
$name,
|
||||
esc_html( $label ),
|
||||
$callback,
|
||||
$this->slug,
|
||||
$this->currentSection,
|
||||
$args
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a text field to this settings page.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $label
|
||||
* @param array $args
|
||||
* @param string $callback
|
||||
*/
|
||||
protected function addTextField( $name, $label, $args = array(), $callback = '' )
|
||||
{
|
||||
if ( ! $callback || ! is_callable( $callback ) ) {
|
||||
$callback = array( $this, 'renderTextField' );
|
||||
}
|
||||
|
||||
$this->addField(
|
||||
$name,
|
||||
$label,
|
||||
$callback,
|
||||
$args + array(
|
||||
'label_for' => $this->slug . '-' . $name,
|
||||
'name' => $name,
|
||||
'attr' => array(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $label
|
||||
* @param string $caption
|
||||
* @param array $args
|
||||
* @param callable $callback
|
||||
*/
|
||||
protected function addCheckboxField( $name, $label, $caption, $args = array(), $callback = '' )
|
||||
{
|
||||
if ( ! $callback || ! is_callable( $callback ) ) {
|
||||
$callback = array( $this, 'renderCheckboxField' );
|
||||
}
|
||||
|
||||
$this->addField(
|
||||
$name,
|
||||
$label,
|
||||
$callback,
|
||||
$args + array(
|
||||
'label_for' => $this->slug . '-' . $name,
|
||||
'name' => $name,
|
||||
'caption' => $caption,
|
||||
'attr' => array(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error.
|
||||
*
|
||||
* @param string $code
|
||||
* @param string $message
|
||||
*/
|
||||
protected function addError( $code, $message )
|
||||
{
|
||||
add_settings_error( $this->slug, $code, $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Errors for this setting.
|
||||
*
|
||||
* @return array {
|
||||
* @type string $setting
|
||||
* @type string $code
|
||||
* @type string $message
|
||||
* @type string $type 'error'
|
||||
* }
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return get_settings_errors( $this->slug );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a setting as text field.
|
||||
*
|
||||
* @param array $args {
|
||||
* @type string $name
|
||||
* @type string $label_for
|
||||
* @type array $attr
|
||||
* }
|
||||
*/
|
||||
public function renderTextField( array $args )
|
||||
{
|
||||
$name = $args['name'];
|
||||
|
||||
$this->renderInputTag( array(
|
||||
'type' => 'text',
|
||||
'id' => $args['label_for'],
|
||||
'class' => 'regular-text',
|
||||
'name' => $this->slug . '[' . $name . ']',
|
||||
'value' => $this[ $name ],
|
||||
) + $args['attr'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a setting as checkbox.
|
||||
*
|
||||
* @param array $args {
|
||||
* @type string $caption
|
||||
* @type string $name
|
||||
* @type string $label_for
|
||||
* @type array $attr
|
||||
* }
|
||||
*/
|
||||
public function renderCheckboxField( array $args )
|
||||
{
|
||||
$name = $args['name'];
|
||||
|
||||
echo '<label>';
|
||||
$this->renderInputTag( array(
|
||||
'type' => 'checkbox',
|
||||
'id' => isset( $args['label_for'] ) ? $args['label_for'] : null,
|
||||
'name' => $this->slug . '[' . $name . ']',
|
||||
'value' => '1',
|
||||
'checked' => $this[ $name ] ? 'checked' : null,
|
||||
) + $args['attr'] );
|
||||
echo ' ' . esc_html( $args['caption'] ) . '</label>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an input tag with given HTML attributes.
|
||||
*
|
||||
* @param array $attr
|
||||
*/
|
||||
protected function renderInputTag( array $attr )
|
||||
{
|
||||
echo '<input';
|
||||
foreach ( $attr as $k => $v ) {
|
||||
if ( null !== $v ) {
|
||||
printf( ' %s="%s"', $k, esc_attr( $v ) );
|
||||
}
|
||||
}
|
||||
echo ' />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output settings page.
|
||||
*/
|
||||
public function renderPage()
|
||||
{
|
||||
if ( ! current_user_can( $this->capability ) ) {
|
||||
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( $this->getPageTitle() ); ?></h2>
|
||||
<form action="options.php" method="post">
|
||||
<?php settings_errors( 'general' ); // “Settings saved.” message ?>
|
||||
<?php settings_fields( $this->slug ); ?>
|
||||
<?php do_settings_sections( $this->slug ); ?>
|
||||
<?php submit_button(); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress;
|
||||
|
||||
|
||||
|
||||
abstract class Theme extends Plugin
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$GLOBALS['content_width'] = $this->getContentWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
abstract public function getContentWidth();
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Try to load a Shy WordPress class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
function shy_wordpress_autoloader( $name )
|
||||
{
|
||||
if ( substr( $name, 0, 14 ) !== 'Shy\\WordPress\\' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = __DIR__ . '/' . str_replace( '\\', DIRECTORY_SEPARATOR, $name ) . '.php';
|
||||
|
||||
return is_file( $name ) && include( $name );
|
||||
}
|
||||
|
||||
spl_autoload_register( 'shy_wordpress_autoloader' );
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress\Tests;
|
||||
|
||||
use Shy\WordPress\HookableTrait;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check that HookableTrait actually works.
|
||||
*
|
||||
* @author Philipp Cordes <pc@irgendware.net>
|
||||
*/
|
||||
class HookableTraitTest extends \WP_UnitTestCase
|
||||
{
|
||||
use HookableTrait;
|
||||
|
||||
|
||||
public function actionMethod()
|
||||
{
|
||||
}
|
||||
|
||||
public function testWorksAsAction()
|
||||
{
|
||||
$this->addHookMethod( 'shywp_test_action', 'actionMethod' );
|
||||
$this->assertTrue( has_action( 'shywp_test_action' ), 'Registering an action via addHookMethod() worked.' );
|
||||
}
|
||||
|
||||
|
||||
public function filterMethod( $value )
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function testWorksAsFilter()
|
||||
{
|
||||
$this->addHookMethod( 'shywp_test_filter', 'filterMethod' );
|
||||
$this->assertTrue( has_filter( 'shywp_test_filter' ), 'Registering a filter via addHookMethod() worked.' );
|
||||
}
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Shy\WordPress\Tests;
|
||||
|
||||
use Shy\WordPress\SettingsPage;
|
||||
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||||
use PHPUnit_Framework_MockObject_Builder_InvocationMocker as BuilderInvocationMocker;
|
||||
|
||||
|
||||
|
||||
class SettingsPageTest extends \WP_UnitTestCase
|
||||
{
|
||||
/**
|
||||
* Mock a SettingsPage.
|
||||
*
|
||||
* @param string|null $slug
|
||||
* @param string $capability
|
||||
* @return SettingsPage|MockObject {
|
||||
* @method BuilderInvocationMocker method(string)
|
||||
* }
|
||||
*/
|
||||
protected function mockSettingsPage( $slug = null, $capability = 'manage_options' )
|
||||
{
|
||||
$builder = $this->getMockBuilder( 'Shy\WordPress\SettingsPage' )
|
||||
->enableProxyingToOriginalMethods();
|
||||
|
||||
if ( null === $slug ) {
|
||||
$builder->disableOriginalConstructor();
|
||||
} else {
|
||||
$builder->setConstructorArgs( array( $slug, $capability ) );
|
||||
}
|
||||
|
||||
return $builder->getMock();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test reading defaults from the settings page.
|
||||
*
|
||||
* @covers SettingsPage::__construct()
|
||||
* @covers SettingsPage::getDefaults()
|
||||
* @covers SettingsPage::offsetExists()
|
||||
* @covers SettingsPage::offsetGet()
|
||||
* @expectedException OutOfBoundsException
|
||||
*/
|
||||
public function testReading()
|
||||
{
|
||||
$slug = 'shywp_settingspage_test_slug_reading';
|
||||
$defaults = array( 'foo' => 'bar' );
|
||||
|
||||
$page = $this->mockSettingsPage( $slug );
|
||||
$page->method( 'getDefaults' )->willReturn( $defaults );
|
||||
|
||||
$this->assertEquals( $defaults, get_option( $slug ) );
|
||||
|
||||
$this->assertArrayHasKey( 'foo', $page );
|
||||
$this->assertEquals( $defaults['foo'], $page['foo'] );
|
||||
|
||||
$this->assertArrayNotHasKey( 'baz', $page );
|
||||
$page['baz'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test writing to the settings page.
|
||||
*
|
||||
* @covers SettingsPage::offsetSet()
|
||||
* @expectedException OutOfBoundsException
|
||||
*/
|
||||
public function testWriting()
|
||||
{
|
||||
$slug = 'shywp_settingspage_test_slug_writing';
|
||||
$defaults = array( 'foo' => 'bar' );
|
||||
|
||||
$page = $this->mockSettingsPage( $slug );
|
||||
$page->method( 'getDefaults' )->willReturn( $defaults );
|
||||
|
||||
$page['foo'] = 'foo';
|
||||
$this->assertEquals( 'foo', $page['foo'] );
|
||||
$page['baz'] = '123';
|
||||
}
|
||||
|
||||
/**
|
||||
* Fail to remove a setting.
|
||||
*
|
||||
* @covers SettingPage::offsetUnset()
|
||||
* @expectedException BadMethodCallException
|
||||
*/
|
||||
public function testRemoving()
|
||||
{
|
||||
$slug = 'shywp_settingspage_test_slug_removing';
|
||||
$defaults = array();
|
||||
|
||||
$page = $this->mockSettingsPage( $slug );
|
||||
$page->method( 'getDefaults' )->willReturn( $defaults );
|
||||
|
||||
unset( $page['baz'] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test whether the settings page can be showed.
|
||||
*
|
||||
* @covers SettingsPage::__construct()
|
||||
* @covers SettingsPage::getParentSlug()
|
||||
* @covers SettingsPage::getPageTitle()
|
||||
* @covers SettingsPage::getMenuTitle()
|
||||
*/
|
||||
public function testRegisterPage()
|
||||
{
|
||||
$this->expectOutputRegex( '/<page&title>/' );
|
||||
|
||||
$slug = 'shywp_settingspage_test_slug_registerpage';
|
||||
|
||||
$page = $this->mockSettingsPage( $slug );
|
||||
$page->method( 'getParentSlug' )->willReturn( 'index.php' );
|
||||
$page->method( 'getPageTitle' )->willReturn( '<page&title>' );
|
||||
$page->method( 'getMenuTitle' )->willReturn( '<menu&title>' );
|
||||
|
||||
$page->expects( $this->once() )->method( 'registerPage' )->with();
|
||||
$page->expects( $this->once() )->method( 'registerSettings' )->with();
|
||||
|
||||
// FIXME: Simulate display of backend.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers SettingsPage::sanitizeOptions()
|
||||
*/
|
||||
public function testSanitize()
|
||||
{
|
||||
$slug = 'shywp_settingspage_test_slug_sanitize';
|
||||
|
||||
$page = $this->mockSettingsPage( $slug );
|
||||
$page->method( 'sanitizeOptions' )->will( $this->returnArgument( 0 ) );
|
||||
$page->expects( $this->atLeastOnce() )->method( 'sanitizeOptions' );
|
||||
|
||||
$this->markTestIncomplete();
|
||||
// FIXME: Simulate form submission
|
||||
}
|
||||
|
||||
public function testRenderTextField()
|
||||
{
|
||||
$this->expectOutputRegex( '/^<input type="text"/' );
|
||||
|
||||
$page = $this->mockSettingsPage();
|
||||
$page->renderTextField( array(
|
||||
'label_for' => 'foo',
|
||||
'name' => 'bar',
|
||||
) );
|
||||
}
|
||||
|
||||
public function testRenderCheckboxField()
|
||||
{
|
||||
$this->expectOutputRegex( '/^<label><input type="checkbox"/' );
|
||||
|
||||
$page = $this->mockSettingsPage();
|
||||
$page->renderCheckboxField( array(
|
||||
'label_for' => 'foo',
|
||||
'name' => 'bar',
|
||||
'caption' => 'baz',
|
||||
) );
|
||||
}
|
||||
|
||||
public function testRenderPage()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->expectOutputRegex( '/<form action="options.php" method="post">.*<3&>.*cryptic_teaser.*</form>/' );
|
||||
|
||||
$slug = 'shywp_settingspage_test_slug_renderpage';
|
||||
|
||||
$page = $this->mockSettingsPage( $slug, 'read' );
|
||||
$page->method( 'getPageTitle' )->willReturn( '<3&>' );
|
||||
$page->method( 'renderSectionTeaser' )->will( $this->returnCallback( function () use ( $teaser ) {
|
||||
echo 'cryptic_teaser';
|
||||
} ) );
|
||||
|
||||
// FIXME: Simulate view of the settings page
|
||||
$page->renderPage();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Try to load a Shy WordPress test class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
function shy_wordpress_tests_autoloader( $name )
|
||||
{
|
||||
if ( substr( $name, 0, 20 ) !== 'Shy\\WordPress\\Tests\\' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = __DIR__ . '/' . str_replace( '\\', DIRECTORY_SEPARATOR, $name ) . '.php';
|
||||
|
||||
return is_file( $name ) && include( $name );
|
||||
}
|
||||
|
||||
spl_autoload_register( 'shy_wordpress_tests_autoloader' );
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit bootstrap file
|
||||
*
|
||||
* Variant of the one from github.com/tierra/wordpress-plugins-tests
|
||||
*/
|
||||
|
||||
require_once '../src/autoloader.php';
|
||||
require_once 'autoloader.php';
|
||||
|
||||
|
||||
|
||||
require_once ( getenv( 'WP_DEVELOP_DIR' ) ?: '../../../..' )
|
||||
. '/tests/phpunit/includes/bootstrap.php';
|
87
changelog
Normal file
@ -0,0 +1,87 @@
|
||||
<h4>Version 4.8.3</h4>
|
||||
<ul>
|
||||
<li>Bugfix</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.8.2</h4>
|
||||
<ul>
|
||||
<li>Added Control element for manual cronjobs</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.8.1</h4>
|
||||
<ul>
|
||||
<li>Handling of deprecated components</h4>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.6.2</h4>
|
||||
<ul>
|
||||
<li>Bugfixes</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h4>Version 4.6.1</h4>
|
||||
<ul>
|
||||
<li>Veranstaltungsanmeldungen</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.9</h4>
|
||||
<ul>
|
||||
<li>Fehlerbehebung</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.8</h4>
|
||||
<ul>
|
||||
<li>Google- und Bing-Verifizierung nun auch im Plugin möglich</li>
|
||||
<li>Neue Nutzerrollen</li>
|
||||
<li>Update in Menüstruktur</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>
|
||||
</ul>
|
||||
|
||||
|
||||
<h4>Version 4.3.4</h4>
|
||||
<ul>
|
||||
<li>Optimized menu tree</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.3</h4>
|
||||
<ul>
|
||||
<li>Bugfix für osobletete Plugins</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.2</h4>
|
||||
<ul>
|
||||
<li>Bugfix: Zeitzone in Kalender korrigiert</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.1</h4>
|
||||
<ul>
|
||||
<li>Mehrsprachigkeit unterstützt</li>
|
||||
<li>Unterstützung für Smartphones</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.2.1</h4>
|
||||
<ul>
|
||||
<li>Erweiterte Sicherheitsfunktionen implemntiert</li>
|
||||
<li>Passwort-Policies implementiert</li>
|
||||
<li>Integration von Limit Login Attempts (classic)</li>
|
||||
<li>Integration von WPS Hide Login</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.1.1</h4>
|
||||
<ul>
|
||||
<li>Erster release des Plugins</li>
|
||||
</ul>
|
28
components/partials/checkbox-option.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
function kompass_print_checkbox(string $settingName) {
|
||||
$currentSetting = get_option($settingName, []);
|
||||
if (!is_array($currentSetting)) {
|
||||
$currentSetting = [$currentSetting];
|
||||
}
|
||||
$options = ['kompass_limit_login_lockout_notify' => [
|
||||
'email' => __('E-Mail to site admin', BDP_LV_PLUGIN_SLUG)
|
||||
],
|
||||
];
|
||||
|
||||
if(!isset($options[$settingName])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$setting = $options[$settingName];
|
||||
foreach ($setting as $radioOption => $optionText) {
|
||||
$isChecked = in_array($radioOption, $currentSetting) ? 'checked ' : '' ;
|
||||
|
||||
echo '<input ' .
|
||||
$isChecked .
|
||||
'type="checkbox"
|
||||
name="' . $settingName . '[]"
|
||||
value="' . $radioOption . '"
|
||||
id="setting_' . $settingName . '_' . $radioOption . '" />' .
|
||||
'<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
|
||||
}
|
||||
}
|
24
components/partials/date-element.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
function _kompass_print_datebox($settingName, $settingValue, $style = '') {
|
||||
echo '<input required style="' . $style . '" type="date" name="' . $settingName . '" value="' . $settingValue. '" />';
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_print_datebox(array $args) {
|
||||
if (!isset($args['setting'])) {
|
||||
wp_die('Missing argument setting at text-element ' . print_r($args, true));
|
||||
}
|
||||
$setting = get_option($args['setting'], null);
|
||||
$setting = $setting ?? ( $args['value'] ?? '' );
|
||||
|
||||
$style = isset($args['style']) ? $args['style'] : '';
|
||||
|
||||
$value = esc_attr($setting);
|
||||
|
||||
if ($value === null && isset($args['value'])) {
|
||||
$value = $args['value'];
|
||||
}
|
||||
_kompass_print_datebox($args['setting'], $value, $style);
|
||||
}
|
9
components/partials/email-link.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
function kompass_get_email_link(string $email) : string {
|
||||
return '<a href="mailto:' . $email . '">' . $email . '</a>';
|
||||
}
|
||||
|
||||
function kompass_print_email_link(string $email)
|
||||
{
|
||||
echo kompass_get_email_link($email);
|
||||
}
|
18
components/partials/form-start.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function kompass_prepare_form($params = [])
|
||||
{
|
||||
if (isset($params['page'])) {
|
||||
echo ' <form method="post" action="admin.php?page=' .$params['page'] . '">';
|
||||
}
|
||||
|
||||
echo '<input type="hidden" name="update_options" value="true" />';
|
||||
foreach ($params as $key => $value) {
|
||||
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_close_form(string $buttonText)
|
||||
{
|
||||
submit_button($buttonText,'button');
|
||||
echo '</form>';
|
||||
}
|
8
components/partials/message-box.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
function kompass_print_message_box(string $message, string $type = 'success')
|
||||
{
|
||||
echo '<div class="notice notice-' . $type .'" style="padding: 5px 10px;">';
|
||||
echo $message;
|
||||
echo '</div>';
|
||||
|
||||
}
|
35
components/partials/radio-option.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
function kompass_print_radio(string $settingName) {
|
||||
$currentSetting = get_option($settingName, '');
|
||||
$options = [
|
||||
'kompass_limit_login_client_type' => [
|
||||
'REMOTE_ADDR' => __('Direct connection', BDP_LV_PLUGIN_SLUG),
|
||||
'HTTP_X_FORWARDED_FOR' => __('Behind a proxy', BDP_LV_PLUGIN_SLUG)
|
||||
],
|
||||
'kompass_limit_login_cookies' => [
|
||||
true => __('Yes', BDP_LV_PLUGIN_SLUG),
|
||||
false => __('No', BDP_LV_PLUGIN_SLUG)
|
||||
],
|
||||
'kompass_password_minimal_strength' => [
|
||||
'1' => __('Allow all password strengths', BDP_LV_PLUGIN_SLUG),
|
||||
'2' => __('At least passwords with medium strength', BDP_LV_PLUGIN_SLUG),
|
||||
'3' => __('Only allow strong passwords', BDP_LV_PLUGIN_SLUG)
|
||||
]
|
||||
];
|
||||
|
||||
if(!isset($options[$settingName])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$setting = $options[$settingName];
|
||||
foreach ($setting as $radioOption => $optionText) {
|
||||
$isChecked = $currentSetting == $radioOption ? 'checked ' : '' ;
|
||||
echo '<input
|
||||
' . $isChecked .
|
||||
' type="radio"
|
||||
name="' . $settingName . '"
|
||||
value="' . $radioOption . '"
|
||||
id="setting_' . $settingName . '_' . $radioOption . '" />' .
|
||||
'<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
|
||||
}
|
||||
}
|
13
components/partials/telephon-link.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
function kompass_get_telephone_link(string $telephonnumber) : string {
|
||||
$numberInternational = $telephonnumber;
|
||||
if (str_starts_with($numberInternational, '0')) {
|
||||
$numberInternational = '+49' . substr($numberInternational,1);
|
||||
}
|
||||
return '<a href="tel:' . $numberInternational . '">' . $telephonnumber . '</a>';
|
||||
}
|
||||
|
||||
function kompass_print_telephone_link(string $telephonnumber)
|
||||
{
|
||||
echo kompass_get_telephone_link($telephonnumber);
|
||||
}
|
40
components/partials/text-element.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
function _kompass_print_textbox($settingName, $settingValue, $style = '', $appendix = '', $lines = 1, $data_type = 'text') {
|
||||
if (1 === $lines) {
|
||||
echo '<input required style="' . $style . '" type="' . $data_type . '" name="' . $settingName . '" value="' . $settingValue . '" />';
|
||||
} else {
|
||||
echo '<textarea required style="' . $style . '" name="' . $settingName . '" rows=' . $lines . '>' . $settingValue . '</textarea>';
|
||||
}
|
||||
if (null !== $appendix) {
|
||||
echo ' ' . $appendix;
|
||||
}
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_print_textbox(array $args) {
|
||||
if (!isset($args['setting'])) {
|
||||
wp_die('Missing argument setting at text-element ' . print_r($args, true));
|
||||
}
|
||||
$setting = get_option($args['setting'], null);
|
||||
$setting = $setting ?? ( $args['value'] ?? '' );
|
||||
$appendix = $args['appendix'] ?? null;
|
||||
$lines = $args['lines'] ?? 1;
|
||||
$type = $args['type'] ?? 'text';
|
||||
|
||||
|
||||
$style = isset($args['style']) ? $args['style'] : '';
|
||||
|
||||
$value = esc_attr($setting);
|
||||
if (isset($args['unit_division'])) {
|
||||
$value = (int)$value / (int)$args['unit_division'];
|
||||
}
|
||||
|
||||
if ($value === null && isset($args['value'])) {
|
||||
$value = $args['value'];
|
||||
}
|
||||
|
||||
|
||||
_kompass_print_textbox($args['setting'], $value, $style, $appendix, $lines, $type);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
require_once (ABSPATH . '/wp-admin/includes/plugin.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.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 (ABSPATH . '/wp-includes/pluggable.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/core/frontend-functions.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php');
|
@ -1,179 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action('admin_enqueue_scripts', 'bdp_update_dashboard_style');
|
||||
add_action('login_enqueue_scripts', 'bdp_update_login_style');
|
||||
|
||||
function bdp_update_login_style() {
|
||||
$css = file_get_contents(BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl');
|
||||
echo str_replace('%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css);
|
||||
}
|
||||
|
||||
function bdp_update_dashboard_style() {
|
||||
wp_enqueue_style('custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css');
|
||||
wp_enqueue_style('custom-calendar-styles', BDP_LV_PLUGIN_URL . '/assets/calendar.css');
|
||||
wp_enqueue_style('custom-security-styles', BDP_LV_PLUGIN_URL . '/assets/security.css');
|
||||
}
|
||||
|
||||
|
||||
function bdp_add_menu_security() {
|
||||
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
|
||||
|
||||
add_menu_page(
|
||||
'Sicherheit',
|
||||
'Erweiterte<br />Sicherheit',
|
||||
'manage_options',
|
||||
'site-health.php',
|
||||
'',
|
||||
'dashicons-admin-network',
|
||||
5
|
||||
);
|
||||
|
||||
https://wordpress.local.development.contelli.de/wp-admin/admin.php?page=limit-login-attempts
|
||||
add_submenu_page('site-health.php',
|
||||
'Login-Kontrolle',
|
||||
'Login-Kontrolle',
|
||||
'manage_options',
|
||||
get_admin_url() . 'admin.php?page=limit-login-attempts'
|
||||
);
|
||||
}
|
||||
|
||||
function bdp_add_menu_contents() {
|
||||
add_menu_page(
|
||||
'Beiträge',
|
||||
'Inhalte',
|
||||
'edit_posts',
|
||||
'edit.php',
|
||||
'',
|
||||
'dashicons-format-aside',
|
||||
4
|
||||
);
|
||||
|
||||
add_submenu_page('edit.php',
|
||||
'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',
|
||||
'comments',
|
||||
'Kommentare',
|
||||
'edit_posts',
|
||||
'edit-comments.php'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function bdp_add_menu_mein_lv() {
|
||||
$location = BDP_LV_PLUGIN_DIR . '/modules/';
|
||||
$mainSlug = $location . 'index.php';
|
||||
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
|
||||
|
||||
add_menu_page(
|
||||
'Mein BDP',
|
||||
'BdP',
|
||||
'manage_options',
|
||||
$mainSlug,
|
||||
'',
|
||||
BDP_LV_PLUGIN_URL . '/icon.png',
|
||||
3
|
||||
);
|
||||
|
||||
add_submenu_page($mainSlug,
|
||||
'calendar_settings',
|
||||
'Kalender-Einstellungen',
|
||||
'manage_options',
|
||||
$moduleLoad . 'calendar'
|
||||
);
|
||||
|
||||
add_submenu_page($mainSlug,
|
||||
'calendar_settings',
|
||||
'Über',
|
||||
'manage_options',
|
||||
$moduleLoad . 'about'
|
||||
);
|
||||
}
|
||||
|
||||
function bdp_add_menu_setup() {
|
||||
add_menu_page(
|
||||
'Allgemeine Einstellungen',
|
||||
'Webseiten-Setup',
|
||||
'manage_options',
|
||||
'users.php',
|
||||
'',
|
||||
'dashicons-admin-generic',
|
||||
6
|
||||
);
|
||||
|
||||
add_submenu_page('users.php',
|
||||
'Allgemeine Einstellungen',
|
||||
'Allgemeine Einstellungen',
|
||||
'manage_options',
|
||||
'options-general.php'
|
||||
);
|
||||
|
||||
add_submenu_page('users.php',
|
||||
'Design-Einstellungen',
|
||||
'Design',
|
||||
'manage_options',
|
||||
'customize.php?return=/wp-admin/'
|
||||
);
|
||||
|
||||
add_submenu_page('users.php',
|
||||
'plugins',
|
||||
'Erweiterungen',
|
||||
'manage_options',
|
||||
'plugins.php'
|
||||
);
|
||||
|
||||
|
||||
add_submenu_page('users.php',
|
||||
'themes',
|
||||
'Designs',
|
||||
'manage_options',
|
||||
'themes.php'
|
||||
);
|
||||
}
|
||||
|
||||
function bdp_cleanup_menu()
|
||||
{
|
||||
global $submenu;
|
||||
|
||||
remove_menu_page('edit-comments.php');
|
||||
remove_menu_page('edit.php');
|
||||
remove_menu_page('edit.php?post_type=page');
|
||||
remove_menu_page('upload.php');
|
||||
remove_menu_page('themes.php');
|
||||
remove_menu_page('plugins.php');
|
||||
remove_menu_page('options-general.php');
|
||||
remove_menu_page('users.php');
|
||||
remove_menu_page('tools.php');
|
||||
|
||||
bdp_add_menu_contents();
|
||||
bdp_add_menu_setup();
|
||||
bdp_add_menu_security();
|
||||
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
add_action('admin_menu', 'bdp_cleanup_menu');
|
||||
bdp_add_menu_mein_lv();
|
||||
}
|
71
includes/DatabaseHandler.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class DatabaseHandler {
|
||||
public function readFromDb(string $table, array $conditions = []) : array {
|
||||
global $wpdb;
|
||||
$sql = 'SELECT * FROM ' . $wpdb->prefix . $table . $this->parseConditions($conditions);
|
||||
return $this->getResults( $sql );
|
||||
}
|
||||
|
||||
public function readSqlFromDb(string $tableName, string $preparedSql) : array
|
||||
{
|
||||
global $wpdb;
|
||||
$sql = str_replace('%tablename%', $wpdb->prefix . $tableName, $preparedSql );
|
||||
return $this->getResults($sql);
|
||||
}
|
||||
|
||||
public function deleteFromDb(string $table, array $conditions = []) {
|
||||
global $wpdb;
|
||||
$table = $wpdb->prefix . $table;
|
||||
$wpdb->delete($table, $conditions);
|
||||
}
|
||||
|
||||
public function insertRows(string $tableName, array $newData) : ?int
|
||||
{
|
||||
global $wpdb;
|
||||
$tableName = $wpdb->prefix . $tableName;
|
||||
|
||||
|
||||
if (!$wpdb->insert( $tableName, $newData )) {
|
||||
return null;
|
||||
};
|
||||
return $wpdb->insert_id;
|
||||
}
|
||||
|
||||
public function updateRows(string $tableName, array $newData, $conditions = [])
|
||||
{
|
||||
global $wpdb;
|
||||
$tableName = $wpdb->prefix . $tableName;
|
||||
return $wpdb->update( $tableName, $newData, $conditions );
|
||||
}
|
||||
|
||||
public function countSqlRows(string $tableName, array $conditions = []) : int
|
||||
{
|
||||
global $wpdb;
|
||||
$sql = 'SELECT COUNT(*) as count_data FROM ' . $wpdb->prefix . $tableName . $this->parseConditions($conditions);
|
||||
$res = $this->getResults( $sql );
|
||||
$res = $res[0];
|
||||
return (int)$res->count_data;
|
||||
}
|
||||
|
||||
private function getResults(string $sql) : array
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_results($sql, OBJECT );
|
||||
}
|
||||
|
||||
private function parseConditions(array $conditionArray) : string
|
||||
{
|
||||
global $wpdb;
|
||||
$_tmpArr = [];
|
||||
foreach ($conditionArray as $key => $value) {
|
||||
$_tmpArr[] = '`' . $key .'` = "' . $wpdb->_real_escape($value) . '"';
|
||||
}
|
||||
|
||||
$returnString = implode(' AND ', $_tmpArr);
|
||||
return $returnString !== '' ? (' WHERE ' . $returnString) : '';
|
||||
}
|
||||
}
|
56
includes/FileAccess.class.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class FileAccess extends \WP_Filesystem_Direct
|
||||
{
|
||||
public const HTACCESS_MAIN = '/.htaccess';
|
||||
public const HTACCESS_UPLOADS = '/wp-content/uploads/.htaccess';
|
||||
|
||||
public function __construct( $arg = null )
|
||||
{
|
||||
if ( ! defined( 'FS_CHMOD_FILE' ) ) {
|
||||
define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static function htaccessContains(string $needle, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
return str_contains(FileAccess::readHtaccess($file), $needle);
|
||||
}
|
||||
|
||||
public static function readHtaccess($file = self::HTACCESS_MAIN) : string
|
||||
{
|
||||
$wfs = new self();
|
||||
if (!$wfs->exists(ABSPATH . $file)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $wfs->get_contents(ABSPATH . $file);
|
||||
}
|
||||
|
||||
public static function writeHtaccess(string $value, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
$wfs = new self();
|
||||
$wfs->put_contents(ABSPATH . $file, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function insertInHtaccess(string $element, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
if (FileAccess::htaccessContains($element, $file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$htaccessFile = FileAccess::readHtaccess($file);
|
||||
$htaccessFile .= PHP_EOL . $element . PHP_EOL;
|
||||
FileAccess::writeHtaccess($htaccessFile, $file);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function deleteFromHtaccess(string $element, $file = self::HTACCESS_MAIN) : bool {
|
||||
$htaccessFile = str_replace($element . PHP_EOL, '', FileAccess::readHtaccess($file));
|
||||
return FileAccess::writeHtaccess($htaccessFile, $file);
|
||||
}
|
||||
}
|
89
includes/WpConfigEditor.class.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class WpConfigEditor extends \WP_Filesystem_Direct
|
||||
{
|
||||
public const WP_CONFIG_FILE = '/wp-config.php';
|
||||
|
||||
public function __construct($arg = null)
|
||||
{
|
||||
if (!defined('FS_CHMOD_FILE')) {
|
||||
define('FS_CHMOD_FILE', (fileperms(ABSPATH . 'index.php') & 0777 | 0644));
|
||||
}
|
||||
}
|
||||
|
||||
public function readConfig(): string
|
||||
{
|
||||
if (!$this->exists(ABSPATH . self::WP_CONFIG_FILE)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->get_contents(ABSPATH . self::WP_CONFIG_FILE);
|
||||
}
|
||||
|
||||
public function writeConfig($value): bool
|
||||
{
|
||||
$value = str_replace('<?php', '', $value);
|
||||
$value = str_replace('<?', '', $value);
|
||||
$value = str_replace('?>', '', $value);
|
||||
|
||||
$value = str_replace(PHP_EOL . PHP_EOL, PHP_EOL, $value);
|
||||
|
||||
$value = '<?php' . PHP_EOL . $value;
|
||||
$this->put_contents(ABSPATH . self::WP_CONFIG_FILE, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function updateConfig($key, $value): bool
|
||||
{
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
if (null === self::getConfigValue($key)) {
|
||||
$configContent .= "define( '$key', $value );" . PHP_EOL;
|
||||
}
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
$configContent = str_replace($matches[0], "define( '$key', $value );", $configContent);
|
||||
return $wfs->writeConfig($configContent);
|
||||
}
|
||||
|
||||
public static function getConfigValue($key): ?string
|
||||
{
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
if (count($matches) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return trim($matches[2]);
|
||||
}
|
||||
|
||||
public static function updateSiteKeys(string $newKeySet)
|
||||
{
|
||||
foreach (explode(PHP_EOL, trim($newKeySet)) as $currentKeyLine) {
|
||||
preg_match("/define\([ ]?'(.*)'\,[ ]?(.*)[ ]?\);/", $currentKeyLine, $matches);
|
||||
self::updateConfig($matches[1], trim($matches[2]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function deleteConfigKey($key): bool
|
||||
{
|
||||
if (null === self::getConfigValue($key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
$configContent = str_replace($matches[0], '', $configContent);
|
||||
return $wfs->writeConfig($configContent);
|
||||
}
|
||||
}
|
47
includes/action_caller.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
if (!isset($loginHandler)) {
|
||||
$loginHandler = new \Bdp\Modules\LimitLoginAttempts\Controllers\LoginHandler();
|
||||
}
|
||||
|
||||
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', 'kompass_admin_init');
|
||||
|
||||
if (get_option('kompass_cookies', false)) {
|
||||
$loginHandler->handleCookies();
|
||||
add_action('auth_cookie_bad_username', [$loginHandler, 'checkFailedCookies']);
|
||||
add_action('auth_cookie_valid', [$loginHandler, 'onValidCookie'], 10, 2);
|
||||
}
|
||||
|
||||
if (isset($_POST['save_kompass_balist_list_type'])) {
|
||||
updateBlockOrAllowList($_POST);
|
||||
}
|
||||
|
||||
function add_custom_admin_bar_item() {
|
||||
global $wp_admin_bar;
|
||||
|
||||
// Überprüfen, ob der Benutzer die erforderliche Berechtigung hat
|
||||
if ( current_user_can( 'show_groups' ) ) {
|
||||
// Das Array mit den Eigenschaften des benutzerdefinierten Elements
|
||||
$args = [
|
||||
'id' => 'kompass_events',
|
||||
'title' => '<span class="ab-icon dashicons-tickets-alt"></span>' .
|
||||
'<span class="ab-label">' .__('Events', BDP_LV_PLUGIN_SLUG) . '</span>',
|
||||
'href' => get_admin_url() . 'admin.php?page=kompass-events',
|
||||
|
||||
];
|
||||
|
||||
// Das benutzerdefinierte Element zur Admin-Leiste hinzufügen
|
||||
$wp_admin_bar->add_node( $args );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Die Funktion aufrufen, um das benutzerdefinierte Element zur Admin-Leiste hinzuzufügen
|
||||
add_action( 'admin_bar_menu', 'add_custom_admin_bar_item', 50 );
|
||||
|
||||
add_action('wp_head', 'kompass_seo_add_verifications' );
|
34
includes/class-modelcommon.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class CommonModel extends \stdClass {
|
||||
protected string $_tablename;
|
||||
|
||||
public static function load_by_id(string $table_name, int $object_id) {
|
||||
global $dbHandler;
|
||||
|
||||
$data = $dbHandler->readFromDb($table_name, ['id' => $object_id]);
|
||||
$class = new CommonModel();
|
||||
|
||||
foreach (get_object_vars($data[0]) as $key => $value) {
|
||||
$class->$key = $value;
|
||||
}
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
global $dbHandler;
|
||||
|
||||
}
|
||||
public function is_fullaged() : bool {
|
||||
return kompass_is_fullaged($this->geburtsdatum);
|
||||
}
|
||||
|
||||
public function get_age() {
|
||||
$obj_birthday = \DateTime::createFromFormat('Y-m-d', $this->geburtsdatum);
|
||||
$today = new \DateTime();
|
||||
$compare = date_diff($today, $obj_birthday);
|
||||
return $compare->y;
|
||||
}
|
||||
}
|
7
includes/environment.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
define('BDP_LV_PLUGIN_SLUG', 'bdp-kompass');
|
||||
define('BDP_LV_STARTUP_FILE', WP_PLUGIN_DIR . '/' . BDP_LV_PLUGIN_SLUG . '/' . BDP_LV_PLUGIN_SLUG . '.php');
|
||||
|
||||
define('BDP_LV_PLUGIN_DIR', plugin_dir_path(BDP_LV_STARTUP_FILE));
|
||||
define('BDP_LV_PLUGIN_URL', plugin_dir_url(BDP_LV_STARTUP_FILE));
|
59
includes/filters.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Bdp\Modules\EventParticipants\Controllers\EventSignupPageController;
|
||||
use Bdp\Modules\EventParticipants\Controllers\RegisterMemberController;
|
||||
|
||||
add_action( 'plugins_loaded', 'bdp_kompass_load_plugin_textdomain' );
|
||||
|
||||
register_activation_hook(BDP_LV_STARTUP_FILE, 'bdp_plugin_install');
|
||||
add_action('init', 'bdp_plugin_init');
|
||||
|
||||
|
||||
|
||||
function _protect_wp_disablexmlrpc_string() {
|
||||
return "<FilesMatch \"xmlrpc.php\">
|
||||
Require all denied
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_script_execution_string() {
|
||||
return '<FilesMatch "\.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$">' . "
|
||||
deny from all
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_special_files_string() {
|
||||
return '<FilesMatch "^.*(README|error_log|wp-config\.php|user.ini|log|php.ini|\.[hH][tT][aApP].*)$">' . "
|
||||
deny from all
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_directory_listing_string() {
|
||||
return 'Options -Indexes';
|
||||
}
|
||||
|
||||
function _protect_wp_secure_include_dir_string() {
|
||||
return "RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^wp-admin/includes/ - [F,L]
|
||||
RewriteRule !^wp-includes/ - [S=3]
|
||||
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
|
||||
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
|
||||
RewriteRule ^wp-includes/theme-compat/ - [F,L]";
|
||||
}
|
||||
|
||||
function _protect_wp_initial_bot_list_array()
|
||||
{
|
||||
return explode(';', 'SemrushBot;AhrefsBot;DotBot;WhatCMS;Rogerbot;trendictionbot;BLEXBot;linkfluence;magpie-crawler;MJ12bot;Mediatoolkitbot;AspiegelBot;DomainStatsBot;Cincraw;Nimbostratus;HTTrack;serpstatbot;omgili;GrapeshotCrawler;MegaIndex;PetalBot;Semanticbot;Cocolyzebot;DomCopBot;Traackr;BomboraBot;Linguee;webtechbot;DomainStatsBot;Clickagy;sqlmap;Internet-structure-research-project-bot;Seekport;AwarioSmartBot;OnalyticaBot;Buck;Riddler;SBL-BOT;DF Bot 1.0;PubMatic Crawler Bot;BVBot;Sogou;Barkrowler;Yandex');
|
||||
}
|
||||
|
||||
|
||||
add_filter('the_content', 'load_kompass_content');
|
||||
|
||||
|
||||
function load_kompass_content($content) {
|
||||
$content = Calendar::printCalendar($content);
|
||||
$content = EventSignupPageController::print_signup_page($content);
|
||||
|
||||
return $content;
|
||||
}
|
70
includes/frontend-functions.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
add_action('admin_enqueue_scripts', 'bdp_update_dashboard_style');
|
||||
add_action('login_enqueue_scripts', 'bdp_update_login_style');
|
||||
|
||||
function bdp_update_login_style() {
|
||||
if (false === (bool)get_option( 'use_mareike_theme', false )) {
|
||||
$css = file_get_contents( BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl' );
|
||||
echo str_replace( '%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css );
|
||||
}
|
||||
}
|
||||
|
||||
function bdp_update_dashboard_style() {
|
||||
if (true === (bool)get_option( 'use_mareike_theme', false )) {
|
||||
#wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/mareike.css' );
|
||||
wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
||||
} else {
|
||||
wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
||||
}
|
||||
wp_enqueue_style('custom-calendar-styles', BDP_LV_PLUGIN_URL . '/assets/calendar.css');
|
||||
wp_enqueue_style('custom-security-styles', BDP_LV_PLUGIN_URL . '/assets/security.css');
|
||||
}
|
||||
|
||||
function kompass_install_plugin($url, $slug) {
|
||||
// Überprüfen, ob die URL gültig ist
|
||||
if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
|
||||
echo 'Ungültige URL';
|
||||
return;
|
||||
}
|
||||
|
||||
// Dateinamen und Pfad festlegen
|
||||
$tmp_file = download_url($url);
|
||||
|
||||
// Überprüfen, ob der Download erfolgreich war
|
||||
if (is_wp_error($tmp_file)) {
|
||||
echo 'Download-Fehler: ' . $tmp_file->get_error_message();
|
||||
return;
|
||||
}
|
||||
|
||||
// Pfad des Plugins
|
||||
$plugin_folder = WP_PLUGIN_DIR;
|
||||
|
||||
// Plugin Upgrader Klassen einbinden
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/misc.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
||||
|
||||
// Plugin upgrader initialisieren
|
||||
$upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
|
||||
|
||||
// Plugin installieren
|
||||
$result = $upgrader->install($tmp_file);
|
||||
|
||||
// Temp Datei löschen
|
||||
unlink($tmp_file);
|
||||
activate_plugin($slug . '/' . $slug . '.php' );
|
||||
|
||||
|
||||
// Überprüfen, ob die Installation erfolgreich war
|
||||
if (is_wp_error($result)) {
|
||||
echo 'Installations-Fehler: ' . $result->get_error_message();
|
||||
} else {
|
||||
echo 'Plugin erfolgreich installiert';
|
||||
}
|
||||
|
||||
}
|
||||
|
21
includes/pdfhandler.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
|
||||
function kompass_create_pdf (string $content, string $filename, string $format = 'portrait', bool $force_download = true): ?string {
|
||||
|
||||
|
||||
$dompdf = new Dompdf();
|
||||
$dompdf->setPaper('A4', $format);
|
||||
$dompdf->loadHtml($content);
|
||||
|
||||
$dompdf->render();
|
||||
|
||||
if (!$force_download) {
|
||||
return $dompdf->output();
|
||||
}
|
||||
|
||||
$dompdf->stream( $filename );
|
||||
return null;
|
||||
}
|