From 600c724500974766d8a53aecb56884c8c9bad529 Mon Sep 17 00:00:00 2001 From: otrok7 <50595291+otrok7@users.noreply.github.com> Date: Sun, 28 Jun 2026 11:52:28 +0200 Subject: [PATCH 1/2] bug fix during reorder booklet pages --- bmlt-meeting-list.php | 4 ++-- public/class-bread-public.php | 21 ++++++++++++++++----- readme.txt | 6 +++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/bmlt-meeting-list.php b/bmlt-meeting-list.php index 3c13e6d..a2e76d3 100644 --- a/bmlt-meeting-list.php +++ b/bmlt-meeting-list.php @@ -11,7 +11,7 @@ * Plugin Name: Bread * Plugin URI: https://bmlt.app * Description: Maintains and generates PDF Meeting Lists from BMLT. - * Version: 2.10.0 + * Version: 2.10.1 * Author: bmlt-enabled * Author URI: https://bmlt.app/ * License: GPL-2.0+ @@ -30,7 +30,7 @@ * Start at version 2.8.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define('BREAD_VERSION', '2.10.0'); +define('BREAD_VERSION', '2.10.1'); /** * The code that runs during plugin activation. diff --git a/public/class-bread-public.php b/public/class-bread-public.php index 3714eb2..cc4da1d 100644 --- a/public/class-bread-public.php +++ b/public/class-bread-public.php @@ -454,6 +454,16 @@ private function drawLinesSeperatingColumns($format, $default_font) $tplId = $this->mpdf->importPage($pagecount); $this->mpdf->SetPageTemplate($tplId); } + private function addFontOptions(array $options): array + { + $defaultConfig = (new ConfigVariables())->getDefaults(); + $defaultFontsConfig = (new FontVariables())->getDefaults(); + return apply_filters("Bread_Mpdf_Init_Options", + array_merge($options, + ['default_font' => $this->options['base_font'], + 'fontDir' => $defaultConfig['fontDir'], + 'fontdata' => $defaultFontsConfig ['fontdata'],])); + } private function reorder_booklet_pages() { if ($this->options['page_fold'] == 'half') { @@ -471,6 +481,7 @@ private function reorder_booklet_pages() 'orientation' => 'L', 'restrictColorSpace' => $this->options['colorspace'], ]; + $mpdfOptions = $this->addFontOptions($mpdfOptions); $ps = $this->options['page_size']; if ($ps == 'ledger') { $mpdfOptions['format'] = 'tabloid'; @@ -479,7 +490,6 @@ private function reorder_booklet_pages() } else { $mpdfOptions['format'] = $ps . '-L'; } - $mpdfOptions = apply_filters("Bread_Mpdf_Init_Options", $mpdfOptions, $this->options); $mpdftmp = new mPDF($mpdfOptions); $this->mpdf->shrink_tables_to_fit = 1; $ow = $mpdftmp->h; @@ -503,7 +513,6 @@ private function reorder_booklet_pages() } else if ($this->options['page_fold'] == 'full' && $this->options['booklet_pages']) { $FilePath = $this->bread->temp_dir() . DIRECTORY_SEPARATOR . $this->get_FilePath('_full'); $this->mpdf->Output($FilePath, 'F'); - $defaultConfig = (new ConfigVariables())->getDefaults(); $mpdfOptions = [ 'mode' => MPDF_MODE, 'tempDir' => $this->bread->temp_dir(), @@ -516,10 +525,8 @@ private function reorder_booklet_pages() 'orientation' => $this->options['page_orientation'], 'restrictColorSpace' => $this->options['colorspace'], 'format' => $this->options['page_size'] . "-" . $this->options['page_orientation'], - 'default_font' => $this->options['base_font'], - 'fontDir' => $defaultConfig['fontDir'], // Set these, so that life is easier to add custom fonts in filters. ]; - $mpdfOptions = apply_filters("Bread_Mpdf_Init_Options", $mpdfOptions, $this->options); + $mpdfOptions = $this->addFontOptions($mpdfOptions); $mpdftmp = new mPDF($mpdfOptions); $this->mpdf->shrink_tables_to_fit = 1; $np = $mpdftmp->SetSourceFile($FilePath); @@ -539,6 +546,7 @@ private function reorder_booklet_pages() } else if ($this->options['page_fold'] == 'pocket') { $FilePath = $this->bread->temp_dir() . DIRECTORY_SEPARATOR . $this->get_FilePath('_pocket'); $this->mpdf->Output($FilePath, 'F'); + $defaultConfig = (new ConfigVariables())->getDefaults(); $mpdfOptions = [ 'mode' => MPDF_MODE, 'tempDir' => $this->bread->temp_dir(), @@ -552,6 +560,7 @@ private function reorder_booklet_pages() 'orientation' => 'L', 'restrictColorSpace' => $this->options['colorspace'], ]; + $mpdfOptions = $this->addFontOptions($mpdfOptions); $orientation = $this->options['page_size'] == 'ledger' ? 'P' : 'L'; $mpdftmp = new mPDF($mpdfOptions); $this->mpdf->shrink_tables_to_fit = 1; @@ -572,6 +581,7 @@ private function reorder_booklet_pages() } else if ($this->options['page_fold'] == 'flyer') { $FilePath = $this->bread->temp_dir() . DIRECTORY_SEPARATOR . $this->get_FilePath('_flyer'); $this->mpdf->Output($FilePath, 'F'); + $defaultConfig = (new ConfigVariables())->getDefaults(); $mpdfOptions = [ 'mode' => MPDF_MODE, 'tempDir' => $this->bread->temp_dir(), @@ -585,6 +595,7 @@ private function reorder_booklet_pages() 'orientation' => 'L', 'restrictColorSpace' => $this->options['colorspace'], ]; + $mpdfOptions = $this->addFontOptions($mpdfOptions); $mpdftmp = new mPDF($mpdfOptions); $this->mpdf->shrink_tables_to_fit = 1; $np = $mpdftmp->SetSourceFile($FilePath); diff --git a/readme.txt b/readme.txt index def11d6..02d7293 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: meeting list, bmlt, narcotics anonymous, na Requires PHP: 8.1 Requires at least: 6.2 Tested up to: 7.0 -Stable tag: 2.10.0 +Stable tag: 2.10.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -55,6 +55,10 @@ Follow all these steps, keep in mind that once you start using bread, it's not g == Changelog == += 2.10.1 = +* Fix error when reordering booklet pages. + + = 2.10.0 = * [bread_button] shortcode added that can generate PDFs even when the hosting provider has blocked access to the BMLT server. * PDF Core Fonts (Helvertica, New Times Roman and Courier) may be selected From 9a2abb6f2749fd0934f283141a57340a74fee7a7 Mon Sep 17 00:00:00 2001 From: otrok7 <50595291+otrok7@users.noreply.github.com> Date: Sun, 28 Jun 2026 17:16:02 +0200 Subject: [PATCH 2/2] lint --- public/class-bread-public.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/public/class-bread-public.php b/public/class-bread-public.php index cc4da1d..c326a2f 100644 --- a/public/class-bread-public.php +++ b/public/class-bread-public.php @@ -458,11 +458,16 @@ private function addFontOptions(array $options): array { $defaultConfig = (new ConfigVariables())->getDefaults(); $defaultFontsConfig = (new FontVariables())->getDefaults(); - return apply_filters("Bread_Mpdf_Init_Options", - array_merge($options, - ['default_font' => $this->options['base_font'], + return apply_filters( + "Bread_Mpdf_Init_Options", + array_merge( + $options, + ['default_font' => $this->options['base_font'], 'fontDir' => $defaultConfig['fontDir'], - 'fontdata' => $defaultFontsConfig ['fontdata'],])); + 'fontdata' => $defaultFontsConfig ['fontdata'], + ] + ) + ); } private function reorder_booklet_pages() {