From ed49d253ecc985940b45a773e06229a0a6d156d4 Mon Sep 17 00:00:00 2001 From: "DAVE-PC\\david" Date: Tue, 31 Jul 2018 21:23:29 +0200 Subject: [PATCH] possible fix for release on wordpress.org (fixes Chyby #2) --- .gitattributes | 2 - README.md | 2 +- app/Admin/Admin.php | 2 - app/Admin/PageSubtitle.php | 50 ------------------------- app/Customizer/Background.php | 16 ++++---- app/Customizer/BorderRadius.php | 6 +-- app/Customizer/ColorVariant.php | 6 +-- app/Customizer/Content.php | 22 +++++------ app/Customizer/Footer.php | 10 ++--- app/Customizer/Init.php | 2 +- app/Customizer/Menu.php | 14 +++---- app/Customizer/PageHeader.php | 37 ++++--------------- app/Customizer/Sidebar.php | 12 +++--- app/Front/Front.php | 9 ----- app/Utils/Helpers.php | 2 +- functions.php | 53 +++++++++++++++------------ readme.txt | 46 +++++++++++++++++++++-- style.css | 5 ++- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_static.php | 1 - 20 files changed, 128 insertions(+), 170 deletions(-) delete mode 100644 app/Admin/PageSubtitle.php diff --git a/.gitattributes b/.gitattributes index 22e4776..297ea5a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,8 +10,6 @@ composer.json export-ignore composer.lock export-ignore /assets/dev/ export-ignore -/assets/css-dev/ export-ignore -/assets/js-dev/ export-ignore /assets/img-dev/ export-ignore /vendor/aristath/kirki/.gitignore export-ignore \ No newline at end of file diff --git a/README.md b/README.md index 59a097b..4c586af 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# crdm-spolky-zaklad +# crdm-basic diff --git a/app/Admin/Admin.php b/app/Admin/Admin.php index e15b3f5..8edf670 100644 --- a/app/Admin/Admin.php +++ b/app/Admin/Admin.php @@ -6,8 +6,6 @@ final class Init { public function __construct() { $this->initHooks(); - - ( new PageSubtitle() ); } private function initHooks() { diff --git a/app/Admin/PageSubtitle.php b/app/Admin/PageSubtitle.php deleted file mode 100644 index 361a2d5..0000000 --- a/app/Admin/PageSubtitle.php +++ /dev/null @@ -1,50 +0,0 @@ -initHooks(); - } - - protected function initHooks() { - add_action( 'save_post', [ $this, 'saveSubtitle' ] ); - add_action( 'edit_form_after_title', [ $this, 'showSubtitleInputField' ] ); - } - - public function saveSubtitle( int $postId ) { - if ( ! isset( $_POST['crdm_page_subtitle'] ) ) { - return false; - } - - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { - return false; - } - - if ( ! isset( $_POST['post_type'] ) || $_POST['post_type'] != 'page' ) { - return false; - } - - if ( ! current_user_can( 'edit_page', $postId ) ) { - return false; - } - - return update_post_meta( $postId, 'crdm_page_subtitle', stripslashes( esc_attr( $_POST['crdm_page_subtitle'] ) ) ); - } - - public function showSubtitleInputField( \WP_Post $post ) { - ?> -
- - -
- sectionId, [ - 'title' => esc_attr__( 'Pozadí', 'crdm_basic' ), + 'title' => esc_attr__( 'Pozadí', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,7 +30,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'webBg', - 'label' => esc_attr__( 'Pozadí webu', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí webu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => '#f7f3e2', @@ -51,8 +51,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'headerBg1', - 'label' => esc_attr__( 'Pozadí hlavičky 1', 'crdm_basic' ), - 'description' => esc_attr__( 'Za lištou menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí hlavičky 1', 'crdm-basic' ), + 'description' => esc_attr__( 'Za lištou menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => 'transparent', @@ -73,8 +73,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'headerBg2', - 'label' => esc_attr__( 'Pozadí hlavičky 2', 'crdm_basic' ), - 'description' => esc_attr__( 'V popředí lišty menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí hlavičky 2', 'crdm-basic' ), + 'description' => esc_attr__( 'V popředí lišty menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => 'transparent', @@ -95,8 +95,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'headerBg3', - 'label' => esc_attr__( 'Pozadí hlavičky 3', 'crdm_basic' ), - 'description' => esc_attr__( 'Pod lištou menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí hlavičky 3', 'crdm-basic' ), + 'description' => esc_attr__( 'Pod lištou menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => 'transparent', diff --git a/app/Customizer/BorderRadius.php b/app/Customizer/BorderRadius.php index d6c7a90..48f8aa3 100644 --- a/app/Customizer/BorderRadius.php +++ b/app/Customizer/BorderRadius.php @@ -21,7 +21,7 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Zaoblení', 'crdm_basic' ), + 'title' => esc_attr__( 'Zaoblení', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,8 +30,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'dimension', 'settings' => 'borderRadius', - 'label' => esc_attr__( 'Zaoblení prvků', 'crdm_basic' ), - 'description' => esc_attr__( 'Zadejte včetně jednotky, např.: 10px', 'crdm_basic' ), + 'label' => esc_attr__( 'Zaoblení prvků', 'crdm-basic' ), + 'description' => esc_attr__( 'Zadejte včetně jednotky, např.: 10px', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '0px', 'css_vars' => [ diff --git a/app/Customizer/ColorVariant.php b/app/Customizer/ColorVariant.php index 114ec94..50d22bd 100644 --- a/app/Customizer/ColorVariant.php +++ b/app/Customizer/ColorVariant.php @@ -21,7 +21,7 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Barevná varianta', 'crdm_basic' ), + 'title' => esc_attr__( 'Barevná varianta', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,8 +30,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'radio-image', 'settings' => 'radio_image_setting', - 'label' => esc_attr__( 'Vyberte barevnou variantu', 'crdm_basic' ), - 'description' => esc_attr__( 'POZOR! Po uložení budou stávající nastavení šablony upraveny.', 'crdm_basic' ), + 'label' => esc_attr__( 'Vyberte barevnou variantu', 'crdm-basic' ), + 'description' => esc_attr__( 'POZOR! Po uložení budou stávající nastavení šablony upraveny.', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => 'light', 'choices' => [ diff --git a/app/Customizer/Content.php b/app/Customizer/Content.php index fbdc559..b77f433 100644 --- a/app/Customizer/Content.php +++ b/app/Customizer/Content.php @@ -29,7 +29,7 @@ protected function initHooks() { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Obsah', 'crdm_basic' ), + 'title' => esc_attr__( 'Obsah', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -38,7 +38,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'contentBg', - 'label' => esc_attr__( 'Pozadí', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => 'transparent', @@ -59,7 +59,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentFont', - 'label' => esc_attr__( 'Běžný text', 'crdm_basic' ), + 'label' => esc_attr__( 'Běžný text', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -80,7 +80,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'contentLinksColor', - 'label' => esc_attr__( 'Barva odkazů', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva odkazů', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '#037b8c', 'output' => [ @@ -95,8 +95,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH1Font', - 'label' => esc_attr__( 'Nadpis (H1)', 'crdm_basic' ), - 'description' => esc_attr__( 'Barva bude použita i pro další prvky na stránce (seznamy, tabulky, ...)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H1)', 'crdm-basic' ), + 'description' => esc_attr__( 'Barva bude použita i pro další prvky na stránce (seznamy, tabulky, ...)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -118,7 +118,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH2Font', - 'label' => esc_attr__( 'Nadpis (H2)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H2)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -140,7 +140,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH3Font', - 'label' => esc_attr__( 'Nadpis (H3)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H3)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -162,7 +162,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH4Font', - 'label' => esc_attr__( 'Nadpis (H4)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H4)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -184,7 +184,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH5Font', - 'label' => esc_attr__( 'Nadpis (H5)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H5)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -206,7 +206,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'contentH6Font', - 'label' => esc_attr__( 'Nadpis (H6)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis (H6)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', diff --git a/app/Customizer/Footer.php b/app/Customizer/Footer.php index f76c0b9..b0e03b3 100644 --- a/app/Customizer/Footer.php +++ b/app/Customizer/Footer.php @@ -21,7 +21,7 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Patička', 'crdm_basic' ), + 'title' => esc_attr__( 'Patička', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,7 +30,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'footerBg', - 'label' => esc_attr__( 'Pozadí', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => '#ffffff', @@ -51,7 +51,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'footerTitlesFont', - 'label' => esc_attr__( 'Nadpisy (H2)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpisy (H2)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -73,7 +73,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'footerFont', - 'label' => esc_attr__( 'Běžný text', 'crdm_basic' ), + 'label' => esc_attr__( 'Běžný text', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -94,7 +94,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'footerLinksColor', - 'label' => esc_attr__( 'Barva odkazů', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva odkazů', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '#037b8c', 'output' => [ diff --git a/app/Customizer/Init.php b/app/Customizer/Init.php index e313996..486fba3 100644 --- a/app/Customizer/Init.php +++ b/app/Customizer/Init.php @@ -27,7 +27,7 @@ protected function initKirki() { protected function initPanel() { Kirki::add_panel( self::CONFIG_ID . '_theme', [ - 'title' => esc_attr__( 'Nastavení šablony', 'crdm_basic' ) + 'title' => esc_attr__( 'Nastavení šablony', 'crdm-basic' ) ] ); } diff --git a/app/Customizer/Menu.php b/app/Customizer/Menu.php index 09ba064..3b744ab 100644 --- a/app/Customizer/Menu.php +++ b/app/Customizer/Menu.php @@ -21,7 +21,7 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Menu', 'crdm_basic' ), + 'title' => esc_attr__( 'Menu', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,7 +30,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'menuBg', - 'label' => esc_attr__( 'Pozadí lišty', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí lišty', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => '#037b8c', @@ -51,7 +51,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'menuFont', - 'label' => esc_attr__( 'Položky menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Položky menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'Patrick Hand', @@ -78,7 +78,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'menuSeparatorColor', - 'label' => esc_attr__( 'Barva oddělovače položek menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva oddělovače položek menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '#3b969f', 'output' => [ @@ -93,7 +93,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'submenuBg', - 'label' => esc_attr__( 'Pozadí vysouvacího menu', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí vysouvacího menu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => '#65c3d4', @@ -114,7 +114,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'submenuFont', - 'label' => esc_attr__( 'Položky submenu', 'crdm_basic' ), + 'label' => esc_attr__( 'Položky submenu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'Patrick Hand', @@ -136,7 +136,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'submenuSeparatorColor', - 'label' => esc_attr__( 'Barva oddělovače položek submenu', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva oddělovače položek submenu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '#ffffff', 'output' => [ diff --git a/app/Customizer/PageHeader.php b/app/Customizer/PageHeader.php index 7586cc2..d74547e 100644 --- a/app/Customizer/PageHeader.php +++ b/app/Customizer/PageHeader.php @@ -21,8 +21,8 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Hlavička stránek', 'crdm_basic' ), - 'description' => esc_attr__( 'Hlavička s obrázkem, nadpisem a podnadpisem jednotlivých stránek', 'crdm_basic' ), + 'title' => esc_attr__( 'Hlavička stránek', 'crdm-basic' ), + 'description' => esc_attr__( 'Hlavička s obrázkem a nadpisem jednotlivých stránek', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -31,8 +31,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'pageHeaderBg', - 'label' => esc_attr__( 'Barva boxu', 'crdm_basic' ), - 'description' => esc_attr__( 'Barva pozadí boxu s textem', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva boxu', 'crdm-basic' ), + 'description' => esc_attr__( 'Barva pozadí boxu s textem', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => 'rgba(196, 219, 122, 0.79)', @@ -53,8 +53,8 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'spacing', 'settings' => 'pageHeaderPosition', - 'label' => esc_attr__( 'Pozice boxu', 'crdm_basic' ), - 'description' => esc_attr__( 'Zadejte včetně jednotky, např.: 50px, 10%, ...', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozice boxu', 'crdm-basic' ), + 'description' => esc_attr__( 'Zadejte včetně jednotky, např.: 50px, 10%, ...', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'left' => '0', @@ -73,7 +73,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'pageHeaderH1Font', - 'label' => esc_attr__( 'Nadpis', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpis', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -92,29 +92,6 @@ protected function initControls() { ], 'transport' => 'auto' ] ); - - Kirki::add_field( $this->configId, [ - 'type' => 'typography', - 'settings' => 'pageHeaderH2Font', - 'label' => esc_attr__( 'Podnadpis', 'crdm_basic' ), - 'section' => $this->sectionId, - 'default' => [ - 'font-family' => 'PT Sans', - 'variant' => 'regular', - 'font-size' => '1rem', - 'line-height' => '1.2', - 'letter-spacing' => 'inherit', - 'color' => '#3c2314', - 'text-align' => 'left', - 'text-transform' => 'none' - ], - 'output' => [ - [ - 'element' => '.crdm_page-header_captions h2' - ] - ], - 'transport' => 'auto' - ] ); } } \ No newline at end of file diff --git a/app/Customizer/Sidebar.php b/app/Customizer/Sidebar.php index 264d0ab..c0287f7 100644 --- a/app/Customizer/Sidebar.php +++ b/app/Customizer/Sidebar.php @@ -21,7 +21,7 @@ public function __construct( string $configId, string $panelId ) { protected function initSection() { Kirki::add_section( $this->sectionId, [ - 'title' => esc_attr__( 'Postranní panely', 'crdm_basic' ), + 'title' => esc_attr__( 'Postranní panely', 'crdm-basic' ), 'panel' => $this->panelId ] ); } @@ -30,7 +30,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'background', 'settings' => 'sidebarBg', - 'label' => esc_attr__( 'Pozadí', 'crdm_basic' ), + 'label' => esc_attr__( 'Pozadí', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'background-color' => '#ffffff', @@ -51,7 +51,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'sidebarBoxshadowColor', - 'label' => esc_attr__( 'Barva stínu boxu', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva stínu boxu', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => 'rgba(240, 240, 240, 0.75)', 'output' => [ @@ -67,7 +67,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'sidebarTitlesFont', - 'label' => esc_attr__( 'Nadpisy (H2)', 'crdm_basic' ), + 'label' => esc_attr__( 'Nadpisy (H2)', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -89,7 +89,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'typography', 'settings' => 'sidebarFont', - 'label' => esc_attr__( 'Běžný text', 'crdm_basic' ), + 'label' => esc_attr__( 'Běžný text', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => [ 'font-family' => 'PT Sans', @@ -110,7 +110,7 @@ protected function initControls() { Kirki::add_field( $this->configId, [ 'type' => 'color', 'settings' => 'sidebarLinksColor', - 'label' => esc_attr__( 'Barva odkazů', 'crdm_basic' ), + 'label' => esc_attr__( 'Barva odkazů', 'crdm-basic' ), 'section' => $this->sectionId, 'default' => '#037b8c', 'output' => [ diff --git a/app/Front/Front.php b/app/Front/Front.php index 702e9be..2d5666b 100644 --- a/app/Front/Front.php +++ b/app/Front/Front.php @@ -102,15 +102,6 @@ public function customPageHeaderImage() { - -

- id ) { $class = 'notice notice-' . $type . ' is-dismissible'; printf( '

%2$s

', 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',