', esc_attr( $class ), $message );
}
} );
diff --git a/functions.php b/functions.php
index 7e141b1..0f71110 100644
--- a/functions.php
+++ b/functions.php
@@ -1,7 +1,5 @@
initHooks();
+ add_action( 'after_switch_theme', [ $this, 'switchToPreviousThemeIfIncompatibleVersionOfWpOrPhp' ] );
// if incompatible version of WP / PHP => don´t init
if ( ! $this->isCompatibleVersionOfWp() ||
@@ -29,15 +25,9 @@ public function __construct() {
$this->init();
}
- protected function initHooks() {
- add_action( 'admin_init', [ $this, 'checkCompatibility' ] );
-
- add_action( 'after_switch_theme', [ $this, 'activation' ] );
- add_action( 'switch_theme', [ $this, 'deactivation' ] );
- }
-
protected function init() {
- require CRDM_BASIC_APP_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'aristath' . DIRECTORY_SEPARATOR . 'kirki' . DIRECTORY_SEPARATOR . 'kirki.php'; // init Kirki framework
+ require CRDM_BASIC_APP_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
+ require CRDM_BASIC_APP_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'aristath' . DIRECTORY_SEPARATOR . 'kirki' . DIRECTORY_SEPARATOR . 'kirki.php'; // init Kirki library
( new Crdm\Setup() );
if ( is_admin() ) {
@@ -63,23 +53,38 @@ protected function isCompatibleVersionOfPhp() {
return false;
}
- public function activation() {
- $this->checkCompatibility();
- }
+ public function switchToPreviousThemeIfIncompatibleVersionOfWpOrPhp() {
+ if ( ! $this->isCompatibleVersionOfPhp() || ! $this->isCompatibleVersionOfWp() ) {
- public function deactivation() {
+ if ( ! $this->isCompatibleVersionOfWp() ) {
+ add_action( 'admin_notices', function () {
+ $this->showAdminNotice( esc_html__( 'Šablona ČRDM - základní vyžaduje verzi WordPress 4.9.6 nebo vyšší!', 'crdm-basic' ), 'warning' );
+ } );
+ }
- }
+ if ( ! $this->isCompatibleVersionOfPhp() ) {
+ add_action( 'admin_notices', function () {
+ $this->showAdminNotice( esc_html__( 'Šablona ČRDM - základní vyžaduje verzi PHP 7.0 nebo vyšší!', 'crdm-basic' ), 'warning' );
+ } );
+ }
- public function checkCompatibility() {
- if ( ! $this->isCompatibleVersionOfWp() ) {
- Helpers::showAdminNotice( esc_html__( 'Šablona ČRDM - základní vyžaduje verzi WordPress 4.9.6 nebo vyšší!', 'crdm_basic' ), 'warning' );
- }
+ // Switch back to previous theme
+ switch_theme( get_option( 'theme_switched' ) );
+
+ return false;
- if ( ! $this->isCompatibleVersionOfPhp() ) {
- Helpers::showAdminNotice( esc_html__( 'Šablona ČRDM - základní vyžaduje verzi PHP 7.0 nebo vyšší!', 'crdm_basic' ), 'warning' );
}
+
+ return true;
}
+
+ public function showAdminNotice( $message, $type = 'warning' ) {
+ $class = 'notice notice-' . $type . ' is-dismissible';
+ printf( '
%2$s
', esc_attr( $class ), $message );
+ }
+
}
global $crdmBasicTheme;
diff --git a/readme.txt b/readme.txt
index 5e994ff..e2f66ac 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,18 +1,58 @@
-=== ČRDM - základní šablona ===
+=== ČRDM - Basic ===
Contributors: davidulus, skaut, kalich5
Requires at least: 4.9.7
Tested up to: 5.0
+Requires PHP: 7.0
Version: 0.1
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
== Description ==
+ČRDM - základní šablona
== Installation ==
== Frequently Asked Questions ==
+== License ==
+ČRDM - Basic WordPress Theme, Copyright 2018 Junák – český skaut, z. s. is distributed under the terms of the GNU GPL.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see https://www.gnu.org/copyleft/gpl.html.
+
+= GeneratePress =
+GPLv2 or later
+https://cs.wordpress.org/themes/generatepress/
+
+= Kirki library =
+MIT
+https://wordpress.org/plugins/kirki/
+
+= Images =
+Copyright 2018 Junák – český skaut, z. s. distributed under the terms of the GNU GPL.
+
+= css-vars-ponyfill =
+MIT
+https://github.com/jhildenbiddle/css-vars-ponyfill
+(c) 2018 John Hildenbiddle
+
+= get-css-data =
+MIT
+https://github.com/jhildenbiddle/get-css-data
+(c) 2018 John Hildenbiddle
+
== Changelog ==
-= 1.0 =
-* první verze
+
+= 0.1 =
+* beta verze
diff --git a/style.css b/style.css
index 4eb2df5..f580eaa 100644
--- a/style.css
+++ b/style.css
@@ -1,5 +1,6 @@
+@charset "UTF-8";
/*
- Theme Name: CRDM Basic
+ Theme Name: ČRDM Basic
Theme URI: https://github.com/skaut/crdm-spolky-zaklad
Description: ČRDM - základní šablona
Author: David Odehnal
@@ -8,7 +9,7 @@
Template version: 2.1.3
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
- Text Domain: crdm_basic
+ Text Domain: crdm-basic
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
Version: 0.1
*/
\ No newline at end of file
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index cf0b5f1..fd9b569 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -7,7 +7,6 @@
return array(
'Crdm\\Admin\\Init' => $baseDir . '/app/Admin/Admin.php',
- 'Crdm\\Admin\\PageSubtitle' => $baseDir . '/app/Admin/PageSubtitle.php',
'Crdm\\Customizer\\Background' => $baseDir . '/app/Customizer/Background.php',
'Crdm\\Customizer\\BorderRadius' => $baseDir . '/app/Customizer/BorderRadius.php',
'Crdm\\Customizer\\ColorVariant' => $baseDir . '/app/Customizer/ColorVariant.php',
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index b5886ec..270da28 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -26,7 +26,6 @@ class ComposerStaticInitf051848332d541645f9ca009c5d5ae08
public static $classMap = array (
'Crdm\\Admin\\Init' => __DIR__ . '/../..' . '/app/Admin/Admin.php',
- 'Crdm\\Admin\\PageSubtitle' => __DIR__ . '/../..' . '/app/Admin/PageSubtitle.php',
'Crdm\\Customizer\\Background' => __DIR__ . '/../..' . '/app/Customizer/Background.php',
'Crdm\\Customizer\\BorderRadius' => __DIR__ . '/../..' . '/app/Customizer/BorderRadius.php',
'Crdm\\Customizer\\ColorVariant' => __DIR__ . '/../..' . '/app/Customizer/ColorVariant.php',