diff --git a/.travis.yml b/.travis.yml index db5e1e14..aa7b05bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ env: - WP_VERSION=4.8.8 WP_MULTISITE=0 - WP_VERSION=4.9.9 WP_MULTISITE=0 - WP_VERSION=5.0.3 WP_MULTISITE=0 + - WP_VERSION=5.1 WP_MULTISITE=0 - WP_VERSION=nightly WP_MULTISITE=0 stages: @@ -46,7 +47,7 @@ jobs: script: ./vendor/bin/phpunit --no-coverage --exclude-group unittests - stage: validate name: 'Latest versions' - env: WP_VERSION=5.0.3 WP_MULTISITE=0 + env: WP_VERSION=5.1 WP_MULTISITE=0 php: '7.3' before_install: composer require phpunit/phpunit:5.7.* --dev before_script: @@ -57,6 +58,14 @@ jobs: script: ./vendor/bin/phpunit after_script: - ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT + - stage: test + name: 'Latest versions, pretty permalinks' + env: WP_VERSION=5.1 WP_MULTISITE=0 WP_TESTS_PERMALINK=PRETTY + php: '7.3' + - stage: test + name: 'Latest versions, PATHINFO permalinks' + env: WP_VERSION=5.1 WP_MULTISITE=0 WP_TESTS_PERMALINK=PATHINFO + php: '7.3' matrix: exclude: diff --git a/src/Admin/Initializer.php b/src/Admin/Initializer.php index 532c9edb..66c81efb 100644 --- a/src/Admin/Initializer.php +++ b/src/Admin/Initializer.php @@ -9,6 +9,7 @@ use abrain\Einsatzverwaltung\Options; use abrain\Einsatzverwaltung\PermalinkController; use abrain\Einsatzverwaltung\Settings\MainPage; +use abrain\Einsatzverwaltung\Types\Report; use abrain\Einsatzverwaltung\Utilities; /** @@ -34,6 +35,7 @@ public function __construct(Data $data, Options $options, Utilities $utilities, add_filter('dashboard_glance_items', array($this, 'addReportsToDashboard')); add_filter('plugin_row_meta', array($this, 'pluginMetaLinks'), 10, 2); add_filter("plugin_action_links_{$pluginBasename}", array($this,'addActionLinks')); + add_filter('use_block_editor_for_post_type', array($this, 'useBlockEditorForReports'), 10, 2); $reportListTable = new ReportListTable(); add_filter('manage_edit-einsatz_columns', array($reportListTable, 'filterColumnsEinsatz')); @@ -216,4 +218,19 @@ public function displayAdminNotices() echo 'Anpassung durchführen
'; } } + + /** + * @param bool $useBlockEditor + * @param string $postType + * + * @return bool + */ + public function useBlockEditorForReports($useBlockEditor, $postType) + { + if ($postType === Report::SLUG && get_option('einsatz_disable_blockeditor', '0') === '1') { + return false; + } + + return $useBlockEditor; + } } diff --git a/src/Core.php b/src/Core.php index 5613796c..eedbd8f0 100644 --- a/src/Core.php +++ b/src/Core.php @@ -11,7 +11,7 @@ */ class Core { - const VERSION = '1.5.0'; + const VERSION = '1.5.1'; const DB_VERSION = 40; /** diff --git a/src/PermalinkController.php b/src/PermalinkController.php index 3ac3325b..4ad8e2f3 100644 --- a/src/PermalinkController.php +++ b/src/PermalinkController.php @@ -47,7 +47,7 @@ public function addRewriteRules(Report $report) $this->reportRewriteSlug = $report->rewriteSlug; // add rules for paginated year archive - $base = ltrim($wp_rewrite->front, '/') . $this->reportRewriteSlug; + $base = $this->getRewriteBase(); add_rewrite_rule( $base . '/(\d{4})/page/(\d{1,})/?$', 'index.php?post_type=einsatz&year=$matches[1]&paged=$matches[2]', @@ -140,6 +140,15 @@ public function filterRequest($queryvars) return $this->modifyQueryVars($queryvars, $this->reportPermalink); } + /** + * @return string + */ + public function getRewriteBase() + { + global $wp_rewrite; + return ltrim($wp_rewrite->front, '/') . $this->reportRewriteSlug; + } + /** * Returns the regular expression necessary to disassemble the selector (part of the URL specifying a single report) * @@ -160,7 +169,7 @@ public function getSelectorRegEx($permalink) */ public function getPermalink($selector) { - $path = sprintf('%s/%s', $this->reportRewriteSlug, $selector); + $path = sprintf('%s/%s', $this->getRewriteBase(), $selector); return home_url(user_trailingslashit($path)); } diff --git a/src/Settings/Pages/Advanced.php b/src/Settings/Pages/Advanced.php index 33548ff7..9d817a09 100644 --- a/src/Settings/Pages/Advanced.php +++ b/src/Settings/Pages/Advanced.php @@ -61,6 +61,13 @@ public function addSettingsFields() $this->settingsApiPage, 'einsatzvw_settings_advreport' ); + add_settings_field( + 'einsatzvw_advreport_gutenberg', + 'Gutenberg', + array($this, 'echoFieldGutenberg'), + $this->settingsApiPage, + 'einsatzvw_settings_advreport' + ); } public function addSettingsSections() @@ -144,6 +151,14 @@ public function echoFieldCoreFeatures() echo ''; } + public function echoFieldGutenberg() + { + echo ''; + } + public function echoFieldUrlStructure() { echo '