From 210c0425f5123bffe5677865996c065dd1ff7256 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Fri, 31 Jul 2026 22:00:36 +0200
Subject: [PATCH 1/4] Small features
---
admin/class-bread-admin.php | 13 +++++++++++--
admin/partials/_layout_setup.php | 7 ++-----
admin/tinymce/front_page_button/plugin.min.js | 16 ++++++++++++++--
bmlt-meeting-list.php | 4 ++--
includes/class-bread.php | 6 ++++++
public/class-bread-content-generator.php | 18 ++++++++++++------
public/class-bread-format-manager.php | 16 +++++++++-------
readme.txt | 6 +++++-
8 files changed, 61 insertions(+), 25 deletions(-)
diff --git a/admin/class-bread-admin.php b/admin/class-bread-admin.php
index f87b9625..6baba199 100644
--- a/admin/class-bread-admin.php
+++ b/admin/class-bread-admin.php
@@ -646,6 +646,11 @@ function process_customize_form()
isset($_POST['booklet_pages']) ?
boolval($_POST['booklet_pages']) : false
);
+ $this->bread->setOption(
+ 'booklet_columns',
+ isset($_POST['booklet_columns']) ?
+ intval($_POST['booklet_columns']) : 1
+ );
$this->bread->setOption('meeting_sort', sanitize_text_field($_POST['meeting_sort']));
$this->bread->setOption('main_grouping', sanitize_text_field($_POST['main_grouping']));
$this->bread->setOption('subgrouping', sanitize_text_field($_POST['subgrouping']));
@@ -676,7 +681,12 @@ function process_customize_form()
$this->bread->setOption('used_format_1', isset($_POST['used_format_1']) ? sanitize_text_field($_POST['used_format_1']) : '');
$this->bread->setOption('recurse_service_bodies', isset($_POST['recurse_service_bodies']) ? 1 : 0);
$this->bread->setOption('extra_meetings_enabled', isset($_POST['extra_meetings_enabled']) ? intval($_POST['extra_meetings_enabled']) : 0);
- $this->bread->setOption('include_protection', boolval($_POST['include_protection']));
+ $this->bread->setOption('include_protection', boolval($_POST['include_protection'] ?? false));
+ if ($_POST['include_protection'] ?? false) {
+ $this->bread->setOption('protection_password', sanitize_text_field($_POST['protection_password']));
+ } else {
+ $this->bread->setOption('protection_password', '');
+ }
$this->bread->setOption('weekday_language', sanitize_text_field($_POST['weekday_language']));
$this->bread->setOption('additional_list_language', sanitize_text_field($_POST['additional_list_language']));
$this->bread->setOption('weekday_start', sanitize_text_field($_POST['weekday_start']));
@@ -701,7 +711,6 @@ function process_customize_form()
$this->bread->setOption('base_font', sanitize_text_field($_POST['base_font']));
$this->bread->setOption('colorspace', sanitize_text_field($_POST['colorspace']));
$this->bread->setOption('wheelchair_size', sanitize_text_field($_POST['wheelchair_size']));
- $this->bread->setOption('protection_password', sanitize_text_field($_POST['protection_password']));
$this->bread->setOption('time_clock', sanitize_text_field($_POST['time_clock']));
$this->bread->setOption('time_option', intval($_POST['time_option']));
$this->bread->setOption('remove_space', boolval($_POST['remove_space']));
diff --git a/admin/partials/_layout_setup.php b/admin/partials/_layout_setup.php
index 848755a1..bf00adbb 100644
--- a/admin/partials/_layout_setup.php
+++ b/admin/partials/_layout_setup.php
@@ -85,6 +85,7 @@ function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
getOption('page_fold') == 'full' ? 'checked' : '') ?>>
getOption('booklet_pages') == '1' ? 'checked' : '') ?> />
+ getOption('booklet_columns') == '2' ? 'checked' : '') ?> />
@@ -197,12 +198,8 @@ function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
(?)
diff --git a/admin/tinymce/front_page_button/plugin.min.js b/admin/tinymce/front_page_button/plugin.min.js
index ae6ee072..55cf33b3 100644
--- a/admin/tinymce/front_page_button/plugin.min.js
+++ b/admin/tinymce/front_page_button/plugin.min.js
@@ -33,11 +33,17 @@
text: 'Format Code Legend',
menu: [
{
- text: 'Used Format Codes - Abbreviated - Same language as weekdays text',
+ text: 'Used Format Codes - Abbreviated - Same language as weekdays text/ Two Formats per Row',
onclick: function () {
editor.insertContent('
[format_codes_used_basic]');
}
},
+ {
+ text: 'Used Format Codes - Abbreviated - Same language as weekdays text/ Single Format per Row',
+ onclick: function () {
+ editor.insertContent('
[format_codes_used_basic_large]');
+ }
+ },
{
text: 'Used Format Codes - Detailed - Same language as weekdays text',
onclick: function () {
@@ -51,11 +57,17 @@
}
},
{
- text: 'All Format Codes - Detailed - Same language as weekdays text',
+ text: 'All Format Codes - Detailed - Same language as weekdays text/ Two Formats per Row',
onclick: function () {
editor.insertContent('
[format_codes_all_detailed]
');
}
},
+ {
+ text: 'All Format Codes - Abbreviated - Same language as weekdays text/ Single Format per Row',
+ onclick: function () {
+ editor.insertContent('
[format_codes_used_basic_large]');
+ }
+ },
{
text: 'Format Table in other languages',
onclick: function() {alert("To insert a format table in another language, simply add _{code} to the shortcode, where code is the standard 2-letter abbreviation for the language. Eg, use '_es' to get spanish")}
diff --git a/bmlt-meeting-list.php b/bmlt-meeting-list.php
index 5d46bc7c..bee09967 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.4
+ * Version: 2.10.5
* 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.4');
+define('BREAD_VERSION', '2.10.5');
/**
* The code that runs during plugin activation.
diff --git a/includes/class-bread.php b/includes/class-bread.php
index 73cdbdc4..5de26b1c 100644
--- a/includes/class-bread.php
+++ b/includes/class-bread.php
@@ -696,6 +696,7 @@ private function fillUnsetOptionsInner()
$this->fillUnsetOption('page_fold', 'quad');
$this->fillUnsetOption('meeting_sort', 'day');
$this->fillUnsetStringOption('booklet_pages', false);
+ $this->fillUnsetOption('booklet_columns', 1);
$this->fillUnsetStringOption('borough_suffix', 'Borough');
$this->fillUnsetStringOption('county_suffix', 'County');
$this->fillUnsetStringOption('neighborhood_suffix', 'Neighborhood');
@@ -721,6 +722,11 @@ private function fillUnsetOptionsInner()
$this->fillUnsetOption('include_additional_list', '0');
$this->fillUnsetOption('additional_list_format_key', '');
$this->fillUnsetOption('additional_list_sort_order', 'name');
+ if ($this->options['include_protection']) {
+ $this->fillUnsetStringOption('protection_password', '');
+ } else {
+ $this->options['protection_password'] = '';
+ }
$this->fillUnsetStringOption('protection_password', '');
$this->fillUnsetStringOption('custom_query', '');
$this->fillUnsetStringOption('additional_list_custom_query', '');
diff --git a/public/class-bread-content-generator.php b/public/class-bread-content-generator.php
index 46a1d083..5dcda68b 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -189,6 +189,9 @@ public function generate(int $num_columns): void
$this->mpdf->SetColumns($num_columns, '', $this->options['column_gap']);
if ($this->options['page_fold'] == 'half' || $this->options['page_fold'] == 'full') {
$this->write_front_page();
+ if ($this->options['booklet_columns'] > 1) {
+ $this->mpdf->SetColumns(intval($this->options['booklet_columns']), '', $this->options['column_gap']);
+ }
}
$this->mpdf->WriteHTML('td{font-size: ' . $this->options['content_font_size'] . "pt;line-height:" . $this->options['content_line_height'] . ';background-color:#ffffff00;}', 1);
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['content_font_size'] . 'pt');
@@ -364,9 +367,6 @@ private function getDeepCopy($m)
private function writeMeetings(string $template, Bread_Meetingslist_Structure $meetingslistStructure): void
{
$template = wpautop(stripslashes($template));
- // TODO: figure out why this is necessary
- //$template = preg_replace('/[[:^print:]]/', ' ', $template);
-
$template = str_replace(" ", " ", $template);
$analysedTemplate = $this->analyseTemplate($template);
@@ -411,7 +411,11 @@ private function writeMeetings(string $template, Bread_Meetingslist_Structure $m
private function writeBreak(Mpdf $mpdf)
{
if ($this->options['page_fold'] === 'half' || $this->options['page_fold'] === 'full') {
- $mpdf->WriteHTML("
");
+ if ($this->options['booklet_columns'] > 1) {
+ $mpdf->WriteHTML(" ");
+ } else {
+ $mpdf->WriteHTML(" ");
+ }
} else {
$mpdf->WriteHTML(" ");
}
@@ -535,14 +539,16 @@ private function replace_format_shortcodes(&$data, $page_name)
{
$lang = $this->options['weekday_language'];
$this->shortcode_formats('[format_codes_used_basic]', false, $lang, false, $page_name, $data);
+ $this->shortcode_formats('[format_codes_used_basic_large]', false, $lang, false, $page_name, $data, true);
$this->shortcode_formats('[format_codes_used_detailed]', true, $lang, false, $page_name, $data);
$this->shortcode_formats('[format_codes_used_basic_es]', false, 'es', true, $page_name, $data);
$this->shortcode_formats('[format_codes_used_detailed_es]', true, 'es', true, $page_name, $data);
$this->shortcode_formats('[format_codes_used_basic_fr]', false, 'fr', true, $page_name, $data);
$this->shortcode_formats('[format_codes_all_basic]', false, $lang, true, $page_name, $data);
+ $this->shortcode_formats('[format_codes_all_basic_large]', false, $lang, true, $page_name, $data, true);
$this->shortcode_formats('[format_codes_all_detailed]', true, $lang, true, $page_name, $data);
}
- private function shortcode_formats($shortcode, $detailed, $lang, $isAll, $page, &$str)
+ private function shortcode_formats($shortcode, $detailed, $lang, $isAll, $page, &$str, $large = false)
{
$pos = strpos($str, $shortcode);
if ($pos == false) {
@@ -552,7 +558,7 @@ private function shortcode_formats($shortcode, $detailed, $lang, $isAll, $page,
if ($detailed) {
$value = $this->formatsManager->write_detailed_formats($lang, $isAll, $this->options[$page . '_line_height'], $this->options[$page . '_font_size'] . "pt");
} else {
- $value = $this->formatsManager->write_formats($lang, $isAll, $this->options[$page . '_line_height'], $this->options[$page . '_font_size'] . "pt");
+ $value = $this->formatsManager->write_formats($lang, $isAll, $this->options[$page . '_line_height'], $this->options[$page . '_font_size'] . "pt", !$large);
}
$str = substr($str, 0, $pos) . $value . substr($str, $pos + strlen($shortcode));
}
diff --git a/public/class-bread-format-manager.php b/public/class-bread-format-manager.php
index fa7e9d13..cb263221 100644
--- a/public/class-bread-format-manager.php
+++ b/public/class-bread-format-manager.php
@@ -220,7 +220,7 @@ public function write_detailed_formats(string $lang, bool $isAll, string $lineHe
* @param string $fontSize
* @return void
*/
- public function write_formats(string $lang, bool $isAll, string $lineHeight, string $fontSize)
+ public function write_formats(string $lang, bool $isAll, string $lineHeight, string $fontSize, bool $isTwoPerRow = true)
{
$formats = $isAll ? $this->getAllFormats($lang) : $this->getFormatsUsed($lang);
if (empty($formats)) {
@@ -232,12 +232,14 @@ public function write_formats(string $lang, bool $isAll, string $lineHeight, str
$data .= "" . $formats[$count]['key_string'] . " ";
$data .= "" . $formats[$count]['name_string'] . " ";
$count++;
- if ($count >= count($formats)) {
- $data .= " ";
- $data .= " ";
- } else {
- $data .= "" . $formats[$count]['key_string'] . " ";
- $data .= "" . $formats[$count]['name_string'] . " ";
+ if ($isTwoPerRow) {
+ if ($count >= count($formats)) {
+ $data .= " ";
+ $data .= " ";
+ } else {
+ $data .= "" . $formats[$count]['key_string'] . " ";
+ $data .= "" . $formats[$count]['name_string'] . " ";
+ }
}
$data .= "";
}
diff --git a/readme.txt b/readme.txt
index 084ae91f..0df194a1 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.4
+Stable tag: 2.10.5
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.5 =
+* Booklets can have 2 columns per page.
+* Formats table can have single format per row.
+
= 2.10.4 =
* Fix wizard crashing (#253)
From 63f5f2aaf1293fa92a59acec112ce905dcf27873 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 3 Aug 2026 11:15:22 +0200
Subject: [PATCH 2/4] Handle boolean settings consistently
---
admin/class-bread-admin.php | 40 +++++---------
admin/partials/_bmlt_server_setup.php | 4 +-
admin/partials/_custom_fonts_setup.php | 4 +-
admin/partials/_layout_setup.php | 49 +++++++++--------
admin/partials/_meetings_setup.php | 20 +++----
includes/class-bread-bmlt.php | 4 +-
includes/class-bread.php | 54 ++++++++++---------
public/class-bread-content-generator.php | 9 ++--
public/class-bread-meetingslist-structure.php | 13 +++--
public/class-bread-public.php | 18 +++----
readme.txt | 2 +
tests/BreadMeetinglistStructureTest.php | 9 ++--
12 files changed, 102 insertions(+), 124 deletions(-)
diff --git a/admin/class-bread-admin.php b/admin/class-bread-admin.php
index 6baba199..77c6b27a 100644
--- a/admin/class-bread-admin.php
+++ b/admin/class-bread-admin.php
@@ -578,7 +578,7 @@ function pwsix_process_settings_admin()
if (!$this->current_user_can_modify()) {
return;
}
- if ($this->bread->getRequestedSetting() == 1) {
+ if ($this->bread->getRequestedSetting() === 1) {
return;
}
$this->bread->deleteSetting($this->bread->getRequestedSetting());
@@ -610,14 +610,14 @@ function process_customize_form()
$this->bread->setOption('front_page_line_height', $_POST['front_page_line_height']);
$this->bread->setOption('front_page_font_size', floatval($_POST['front_page_font_size']));
$this->bread->setOption('content_font_size', floatval($_POST['content_font_size']));
- $this->bread->setOption('suppress_heading', floatval($_POST['suppress_heading']));
+ $this->bread->setOption('suppress_heading', isset($_POST['suppress_heading']));
$this->bread->setOption('header_font_size', floatval($_POST['header_font_size']));
$this->bread->setOption('header_text_color', sanitize_hex_color($_POST['header_text_color']));
$this->bread->setOption('header_background_color', sanitize_hex_color($_POST['header_background_color']));
- $this->bread->setOption('header_uppercase', intval($_POST['header_uppercase']));
- $this->bread->setOption('header_bold', intval($_POST['header_bold']));
+ $this->bread->setOption('header_uppercase', isset($_POST['header_uppercase']));
+ $this->bread->setOption('header_bold', isset($_POST['header_bold']));
$this->bread->setOption('sub_header_shown', sanitize_text_field($_POST['sub_header_shown']));
- $this->bread->setOption('cont_header_shown', intval($_POST['cont_header_shown']));
+ $this->bread->setOption('cont_header_shown', isset($_POST['cont_header_shown']));
$this->bread->setOption(
'column_gap',
isset($_POST['column_gap']) ?
@@ -641,16 +641,8 @@ function process_customize_form()
$this->bread->setOption('page_size', sanitize_text_field($_POST['page_size']));
$this->bread->setOption('page_orientation', sanitize_text_field($_POST['page_orientation']));
$this->bread->setOption('page_fold', sanitize_text_field($_POST['page_fold']));
- $this->bread->setOption(
- 'booklet_pages',
- isset($_POST['booklet_pages']) ?
- boolval($_POST['booklet_pages']) : false
- );
- $this->bread->setOption(
- 'booklet_columns',
- isset($_POST['booklet_columns']) ?
- intval($_POST['booklet_columns']) : 1
- );
+ $this->bread->setOption('booklet_pages', isset($_POST['booklet_pages']));
+ $this->bread->setOption('booklet_columns', $_POST['booklet_columns'] ? intval($_POST['booklet_columns']) : 1);
$this->bread->setOption('meeting_sort', sanitize_text_field($_POST['meeting_sort']));
$this->bread->setOption('main_grouping', sanitize_text_field($_POST['main_grouping']));
$this->bread->setOption('subgrouping', sanitize_text_field($_POST['subgrouping']));
@@ -660,11 +652,7 @@ function process_customize_form()
$this->bread->setOption('city_suffix', sanitize_text_field($_POST['city_suffix']));
$this->bread->setOption('meeting_template_content', wp_kses_post($_POST['meeting_template_content']));
$this->bread->setOption('additional_list_template_content', wp_kses_post($_POST['additional_list_template_content']));
- $this->bread->setOption(
- 'column_line',
- isset($_POST['column_line']) ?
- boolval($_POST['column_line']) : 0
- );
+ $this->bread->setOption('column_line', isset($_POST['column_line']));
$this->bread->setOption(
'col_color',
isset($_POST['col_color']) ?
@@ -679,10 +667,10 @@ function process_customize_form()
floatval($_POST['pagenumbering_font_size']) : '9'
);
$this->bread->setOption('used_format_1', isset($_POST['used_format_1']) ? sanitize_text_field($_POST['used_format_1']) : '');
- $this->bread->setOption('recurse_service_bodies', isset($_POST['recurse_service_bodies']) ? 1 : 0);
- $this->bread->setOption('extra_meetings_enabled', isset($_POST['extra_meetings_enabled']) ? intval($_POST['extra_meetings_enabled']) : 0);
- $this->bread->setOption('include_protection', boolval($_POST['include_protection'] ?? false));
- if ($_POST['include_protection'] ?? false) {
+ $this->bread->setOption('recurse_service_bodies', isset($_POST['recurse_service_bodies']));
+ $this->bread->setOption('extra_meetings_enabled', isset($_POST['extra_meetings_enabled']));
+ $this->bread->setOption('include_protection', isset($_POST['include_protection']));
+ if ($this->bread->getOption('include_protection')) {
$this->bread->setOption('protection_password', sanitize_text_field($_POST['protection_password']));
} else {
$this->bread->setOption('protection_password', '');
@@ -705,7 +693,7 @@ function process_customize_form()
isset($_POST['nonmeeting_footer']) ?
sanitize_text_field($_POST['nonmeeting_footer']) : ''
);
- $this->bread->setOption('include_additional_list', boolval($_POST['include_additional_list']));
+ $this->bread->setOption('include_additional_list', isset($_POST['include_additional_list']));
$this->bread->setOption('additional_list_format_key', sanitize_text_field($_POST['additional_list_format_key']));
$this->bread->setOption('additional_list_sort_order', sanitize_text_field($_POST['additional_list_sort_order']));
$this->bread->setOption('base_font', sanitize_text_field($_POST['base_font']));
@@ -721,7 +709,7 @@ function process_customize_form()
$this->bread->setOption('custom_query', sanitize_text_field($_POST['custom_query']));
$this->bread->setOption('additional_list_custom_query', sanitize_text_field($_POST['additional_list_custom_query']));
$this->bread->setOption('user_agent', isset($_POST['user_agent']) ? sanitize_text_field($_POST['user_agent']) : 'None');
- $this->bread->setOption('sslverify', isset($_POST['sslverify']) ? '1' : '0');
+ $this->bread->setOption('sslverify', isset($_POST['sslverify']));
$this->bread->setOption('extra_meetings', array());
if (isset($_POST['extra_meetings'])) {
foreach ($_POST['extra_meetings'] as $extra) {
diff --git a/admin/partials/_bmlt_server_setup.php b/admin/partials/_bmlt_server_setup.php
index ee17f262..995a89d5 100644
--- a/admin/partials/_bmlt_server_setup.php
+++ b/admin/partials/_bmlt_server_setup.php
@@ -54,7 +54,7 @@ function Bread_bmlt_server_setup_page_render(Bread_AdminDisplay $breadAdmin)
- getOption('recurse_service_bodies') == 1 ? 'checked' : '') ?> />
+ getOption('recurse_service_bodies') ? 'checked' : '') ?> />
@@ -93,7 +93,7 @@ function Bread_bmlt_server_setup_page_render(Bread_AdminDisplay $breadAdmin)
- emptyOption('extra_meetings_enabled') && $bread->getOption('extra_meetings_enabled') == 1 ? 'checked' : '') ?> />
+ getOption('extra_meetings_enabled') ? 'checked' : '') ?> />
diff --git a/admin/partials/_custom_fonts_setup.php b/admin/partials/_custom_fonts_setup.php
index ee835687..6def64eb 100644
--- a/admin/partials/_custom_fonts_setup.php
+++ b/admin/partials/_custom_fonts_setup.php
@@ -86,13 +86,13 @@ function prepare_items()
if (isset($_GET['view']) && $_GET['view'] != 'all') {
$this->items = array_filter($this->items, function ($font) {
$bool = in_array($font['slug'], $this->active);
- return ($_GET['view'] == 'active') ? $bool : !$bool;
+ return ($_GET['view'] === 'active') ? $bool : !$bool;
});
}
}
private function selected($a, $b)
{
- return ($a == $b) ? 'selected' : '';
+ return ($a === $b) ? 'selected' : '';
}
private function getAllScripts(): array
{
diff --git a/admin/partials/_layout_setup.php b/admin/partials/_layout_setup.php
index bf00adbb..8ac1c00e 100644
--- a/admin/partials/_layout_setup.php
+++ b/admin/partials/_layout_setup.php
@@ -11,7 +11,7 @@ function echo_font_options(string $base_font, Bread $bread)
continue;
}
$font_info = $infos[$font_key];
- echo '' . esc_html($font_info['name']) . ' ';
+ echo '' . esc_html($font_info['name']) . ' ';
}
}
function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
@@ -72,32 +72,32 @@ function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
type="hidden">
@@ -170,10 +169,10 @@ function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
- getOption('colorspace') == '0' ? "selected=\"selected\"" : "" ?>>
- getOption('colorspace') == '1' ? "selected=\"selected\"" : "" ?>>
- getOption('colorspace') == '2' ? "selected=\"selected\"" : "" ?>>
- getOption('colorspace') == '3' ? "selected=\"selected\"" : "" ?>>
+ getOption('colorspace') === '0' ? "selected=\"selected\"" : "" ?>>
+ getOption('colorspace') === '1' ? "selected=\"selected\"" : "" ?>>
+ getOption('colorspace') === '2' ? "selected=\"selected\"" : "" ?>>
+ getOption('colorspace') === '3' ? "selected=\"selected\"" : "" ?>>
@@ -198,7 +197,7 @@ function Bread_layout_setup_page_render(Bread_AdminDisplay $breadAdmin)
(?)
-
getOption('include_protection') == '1' ? 'checked' : '') ?>>
+
getOption('include_protection') ? 'checked' : '') ?>>
diff --git a/admin/partials/_meetings_setup.php b/admin/partials/_meetings_setup.php
index 8099750a..c10242f8 100644
--- a/admin/partials/_meetings_setup.php
+++ b/admin/partials/_meetings_setup.php
@@ -18,8 +18,7 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
(?)
-
- getOption('suppress_heading') == '1' ? 'checked' : '') ?>>
+ getOption('suppress_heading') ? 'checked' : '') ?>>
@@ -229,8 +225,7 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
getOption('time_option') == '1' || $bread->getOption('time_option') == '' ? 'checked' : '') ?>>
- getOption('remove_space') == '0' || $bread->getOption('remove_space') == '' ? 'checked' : ''; ?>
- >
+ getOption('remove_space') ? 'checked' : ''; ?>>
@@ -241,7 +236,7 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
getOption('time_option') == '2' ? 'checked' : '') ?>>
- getOption('remove_space') == '1') ? 'checked' : ''; ?>>
+ getOption('remove_space') ? 'checked' : ''; ?>>
@@ -320,8 +315,7 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
-
-
getOption('include_additional_list') == '1' ? 'checked' : '') ?>>
+
getOption('include_additional_list') ? 'checked' : '') ?>>
$this->bread->getOption('user_agent')
);
}
- if ($this->bread->getOption('sslverify') == '1') {
+ if ($this->bread->getOption('sslverify')) {
$args['sslverify'] = false;
}
return wp_remote_get($url, $args);
@@ -229,7 +229,7 @@ public function generateDefaultQuery(): string
// only the name of the service body. So we cache the value so it only
// needs to be called once.
if (!$this->default_query) {
- $this->default_query = ($this->bread->getOption('recurse_service_bodies') == 1) ? '&recursive=1' : '';
+ $this->default_query = ($this->bread->getOption('recurse_service_bodies')) ? '&recursive=1' : '';
for ($i=0; $i
bread->getOption('service_bodies')); $i++) {
$area_data = explode(',', $this->bread->getOption('service_bodies')[$i]);
$service_body_id = $this->bread->arraySafeGet($area_data, 1);
diff --git a/includes/class-bread.php b/includes/class-bread.php
index 5de26b1c..30eaa011 100644
--- a/includes/class-bread.php
+++ b/includes/class-bread.php
@@ -627,7 +627,7 @@ public function getday($day, $abbreviate = false, $language = 'en')
}
private function fillUnsetOption($option, $default)
{
- if (!isset($this->options[$option]) || strlen(trim($this->options[$option])) == 0) {
+ if (!isset($this->options[$option]) || (is_string($this->options[$option]) && strlen(trim($this->options[$option])) === 0)) {
$this->options[$option] = $default;
}
}
@@ -675,13 +675,13 @@ private function fillUnsetOptionsInner()
if (floatval($this->options['pageheader_fontsize']) < 4) {
$this->options['pageheader_fontsize'] = 6;
}
- $this->fillUnsetOption('suppress_heading', 0);
+ $this->fillUnsetOption('suppress_heading', false);
$this->fillUnsetOption('header_text_color', '#ffffff');
$this->fillUnsetOption('header_background_color', '#000000');
$this->fillUnsetOption('pageheader_textcolor', '#000000');
$this->fillUnsetOption('pageheader_backgroundcolor', '#ffffff');
- $this->fillUnsetOption('header_uppercase', '0');
- $this->fillUnsetOption('header_bold', '1');
+ $this->fillUnsetOption('header_uppercase', false);
+ $this->fillUnsetOption('header_bold', true);
$this->fillUnsetOption('sub_header_shown', 'none');
$this->fillUnsetOption('margin_top', 3);
$this->fillUnsetOption('margin_bottom', 3);
@@ -703,7 +703,7 @@ private function fillUnsetOptionsInner()
$this->fillUnsetStringOption('city_suffix', 'City');
$this->fillUnsetStringOption('meeting_template_content', '');
$this->fillUnsetStringOption('additional_list_template_content', '');
- $this->fillUnsetOption('column_line', 0);
+ $this->fillUnsetOption('column_line', false);
$this->fillUnsetOption('col_color', '#bfbfbf');
$this->fillUnsetStringOption('custom_section_content', '');
$this->fillUnsetOption('custom_section_line_height', '1');
@@ -713,13 +713,13 @@ private function fillUnsetOptionsInner()
$this->fillUnsetOption('base_font', 'dejavusanscondensed');
$this->fillUnsetOption('colorspace', 0);
$this->fillUnsetArrayOption('service_bodies', []);
- $this->fillUnsetOption('recurse_service_bodies', 1);
- $this->fillUnsetOption('extra_meetings_enabled', 0);
- $this->fillUnsetOption('include_protection', 0);
+ $this->fillUnsetOption('recurse_service_bodies', true);
+ $this->fillUnsetOption('extra_meetings_enabled', false);
+ $this->fillUnsetOption('include_protection', false);
$this->fillUnsetOption('weekday_language', 'en');
$this->fillUnsetStringOption('additional_list_language', ''); // same as main language
$this->fillUnsetOption('weekday_start', '1');
- $this->fillUnsetOption('include_additional_list', '0');
+ $this->fillUnsetOption('include_additional_list', false);
$this->fillUnsetOption('additional_list_format_key', '');
$this->fillUnsetOption('additional_list_sort_order', 'name');
if ($this->options['include_protection']) {
@@ -731,15 +731,15 @@ private function fillUnsetOptionsInner()
$this->fillUnsetStringOption('custom_query', '');
$this->fillUnsetStringOption('additional_list_custom_query', '');
$this->fillUnsetStringOption('user_agent', 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) +bread');
- $this->fillUnsetOption('sslverify', '0');
+ $this->fillUnsetOption('sslverify', false);
$this->fillUnsetOption('cache_time', 0);
$this->fillUnsetOption('wheelchair_size', "20px");
$this->fillUnsetArrayOption('extra_meetings', []);
if (!isset($this->options['extra_meetings'])) {
if (count($this->options['extra_meetings']) > 0) {
- $this->options['extra_meetings_enabled'] = 1;
+ $this->options['extra_meetings_enabled'] = true;
} else {
- $this->options['extra_meetings_enabled'] = 0;
+ $this->options['extra_meetings_enabled'] = false;
}
}
$this->fillUnsetArrayOption('authors', []);
@@ -785,20 +785,6 @@ private function upgrade_settings(): void
$this->options['root_server'] = 'http://' . $this->options['root_server'];
}
}
- if (!isset($this->options['cont_header_shown'])
- && isset($this->options['page_height_fix'])
- ) {
- $fix = floatval($this->options['page_height_fix']);
- // say, the height of 2 lines
- $x = floatval($this->options['content_font_size']) *
- floatval($this->options['content_line_height']) * 2.0 * 0.35; // pt to mm
- if ($fix < $x) {
- $this->options['cont_header_shown'] = true;
- } else {
- $this->options['cont_header_shown'] = false;
- }
- unset($this->options['page_height_fix']);
- }
if ($this->options['weekday_language'] == 'both') {
$this->options['weekday_language'] = "en_es";
}
@@ -816,6 +802,18 @@ private function upgrade_settings(): void
$this->renamed_option('asm_language', 'additional_list_language');
$this->renamed_option('asm_custom_query', 'additional_list_custom_query');
$this->renamed_option('asm_template_content', 'additional_list_template_content');
+
+ $this->boolify_option('recurse_service_bodies');
+ $this->boolify_option('extra_meetings_enabled');
+ $this->boolify_option('include_protection');
+ $this->boolify_option('include_additional_list');
+ $this->boolify_option('column_line');
+ $this->boolify_option('sslverify');
+ $this->boolify_option('suppress_heading');
+ $this->boolify_option('header_uppercase');
+ $this->boolify_option('header_bold');
+ $this->boolify_option('cont_header_shown');
+
if ($this->versionLessThan('2.8')) {
if (($this->options['page_fold'] == 'half' || $this->options['page_fold'] == 'full') && isset($this->options['last_page_content']) && trim($this->options['last_page_content']) !== '') {
$this->options['custom_section_content'] = $this->options['last_page_content'];
@@ -884,6 +882,10 @@ private function renamed_option(string $old, string $new)
}
}
}
+ private function boolify_option(string $option)
+ {
+ $this->options[$option] = boolval($this->options[$option]);
+ }
/**
* Stores the current settings in the Wordpress Options DB.
*
diff --git a/public/class-bread-content-generator.php b/public/class-bread-content-generator.php
index 5dcda68b..dbed7865 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -190,17 +190,16 @@ public function generate(int $num_columns): void
if ($this->options['page_fold'] == 'half' || $this->options['page_fold'] == 'full') {
$this->write_front_page();
if ($this->options['booklet_columns'] > 1) {
- $this->mpdf->SetColumns(intval($this->options['booklet_columns']), '', $this->options['column_gap']);
+ $this->mpdf->SetColumns($this->options['booklet_columns'], '', $this->options['column_gap']);
}
}
- $this->mpdf->WriteHTML('td{font-size: ' . $this->options['content_font_size'] . "pt;line-height:" . $this->options['content_line_height'] . ';background-color:#ffffff00;}', 1);
+ $this->mpdf->WriteHTML('td{font-size: ' . $this->options['content_font_size'] . "pt;line-height:" . $this->options['content_line_height'] . ';}', 1);
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['content_font_size'] . 'pt');
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['content_line_height']);
$lang = $this->options['weekday_language'];
if ($lang == 'fa') {
$this->mpdf->SetDefaultBodyCSS('direction', 'rtl');
}
- $this->mpdf->SetDefaultBodyCSS('background-color', '#ffffff00');
if ($this->options['page_fold'] == 'half' || $this->options['page_fold'] == 'full') {
$this->WriteHTML(' ');
}
@@ -208,7 +207,7 @@ public function generate(int $num_columns): void
foreach ($this->result_meetings as &$value) {
$value = $this->meetingEnhancer->enhance_meeting($value, $lang, $this->formatsManager);
}
- $meetingslistStructure = new Bread_Meetingslist_Structure($this->bread, $this->result_meetings, $lang, $this->options['include_additional_list'] == 0 ? -1 : 0);
+ $meetingslistStructure = new Bread_Meetingslist_Structure($this->bread, $this->result_meetings, $lang, $this->options['include_additional_list'] ? 0 : -1);
$this->writeMeetings($this->options['meeting_template_content'], $meetingslistStructure);
if ($this->options['page_fold'] !== 'half' && $this->options['page_fold'] !== 'full') {
@@ -340,7 +339,7 @@ private function write_custom_section()
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['custom_section_font_size'] . 'pt');
$this->mpdf->SetDefaultBodyCSS('background-color', '#ffffff00');
$data = $this->standard_shortcode_replacement('custom_section');
- $this->mpdf->WriteHTML('td{font-size: ' . $this->options['custom_section_font_size'] . "pt;line-height:" . $this->options['custom_section_line_height'] . ';}', 1);
+ //$this->mpdf->WriteHTML('td{font-size: ' . $this->options['custom_section_font_size'] . "pt;line-height:" . $this->options['custom_section_line_height'] . ';}', 1);
$this->writeHTMLwithAdditionalMeetinglist($data);
}
/**
diff --git a/public/class-bread-meetingslist-structure.php b/public/class-bread-meetingslist-structure.php
index 117fc542..53ba0db8 100644
--- a/public/class-bread-meetingslist-structure.php
+++ b/public/class-bread-meetingslist-structure.php
@@ -155,7 +155,7 @@ function __construct(Bread $bread, array $result_meetings, string $lang, int $in
{
$this->bread = $bread;
$this->options = $bread->getOptions();
- $this->suppress_heading = $this->options['suppress_heading'] == 1;
+ $this->suppress_heading = $this->options['suppress_heading'];
$meeting_sort = $this->options['meeting_sort'];
if ($include_additional_list > 0) {
@@ -180,14 +180,13 @@ function __construct(Bread $bread, array $result_meetings, string $lang, int $in
$header_style .= "line-height:" . $this->options['content_line_height'] . ";";
$header_style .= "text-align:center;padding-top:2px;padding-bottom:3px;";
- if ($this->options['header_uppercase'] == 1) {
+ if ($this->options['header_uppercase']) {
$header_style .= 'text-transform: uppercase;';
}
- if ($this->options['header_bold'] == 0) {
- $header_style .= 'font-weight: normal;';
- }
- if ($this->options['header_bold'] == 1) {
+ if ($this->options['header_bold']) {
$header_style .= 'font-weight: bold;';
+ } else {
+ $header_style .= 'font-weight: normal;';
}
$this->header_style = $header_style;
$this->cont = '(' . $bread->getTranslateTable()[$lang]['CONT'] . ')';
@@ -263,7 +262,7 @@ private function getHeaderMeetings(array &$result_meetings, int $include_additio
$levels = $this->getHeaderLevels();
$headerMeetings = array();
foreach ($result_meetings as &$value) {
- $additional_list_test = $this->additional_list_test($value, $include_additional_list == 1);
+ $additional_list_test = $this->additional_list_test($value, $include_additional_list === 1);
if ((($include_additional_list < 0 && $additional_list_test) ||
($include_additional_list > 0 && !$additional_list_test))) {
continue;
diff --git a/public/class-bread-public.php b/public/class-bread-public.php
index 19cd295b..7e46c08e 100644
--- a/public/class-bread-public.php
+++ b/public/class-bread-public.php
@@ -213,11 +213,11 @@ public function bmlt_meeting_list()
require_once __DIR__ . '/class-bread-format-manager.php';
$default_font = $this->options['base_font'];
$mpdf_init_options = $this->construct_init_options($default_font);
- if (isset($this->options['packTabledata']) && $this->options['packTabledata']) {
+ if ($this->options['packTabledata']) {
$mpdf_init_options['packTabledata'] = true;
}
$this->mpdf = @new mPDF($mpdf_init_options);
- if (isset($this->options['logging']) && $this->options['logging']) {
+ if ($this->options['logging']) {
$logger = new Logger('bread-log');
$site = '';
if (is_multisite()) {
@@ -228,7 +228,7 @@ public function bmlt_meeting_list()
$this->mpdf->showImageErrors = true;
$this->mpdf->setLogger($logger);
}
- if (isset($this->options['simpleTables']) && $this->options['simpleTables']) {
+ if ($this->options['simpleTables']) {
$this->mpdf->simpleTables = true;
}
$this->mpdf->setAutoBottomMargin = 'pad';
@@ -242,10 +242,7 @@ public function bmlt_meeting_list()
$header_stylesheet = (new WP_Filesystem_Direct(null))->get_contents(plugin_dir_path(__FILE__) . 'css/mpdfstyletables.css');
$this->mpdf->WriteHTML($header_stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['content_line_height']);
- $this->mpdf->SetDefaultBodyCSS('background-color', '#ffffff00');
- if ($this->options['column_line'] == 1
- && ($this->options['page_fold'] == 'tri' || $this->options['page_fold'] == 'quad')
- ) {
+ if ($this->options['column_line'] && ($this->options['page_fold'] === 'tri' || $this->options['page_fold'] === 'quad') ) {
$this->drawLinesSeperatingColumns($mpdf_init_options['format'], $default_font);
}
$result = $this->bread->bmlt()->doMainQuery();
@@ -298,7 +295,7 @@ public function bmlt_meeting_list()
$generator->generate($num_columns);
$this->mpdf->SetDisplayMode('fullpage', 'two');
$this->reorder_booklet_pages();
- if ($this->options['include_protection'] == 1) {
+ if ($this->options['include_protection']) {
// 'copy','print','modify','annot-forms','fill-forms','extract','assemble','print-highres'
$this->mpdf->SetProtection(array('copy', 'print', 'print-highres'), '', $this->options['protection_password']);
}
@@ -453,7 +450,7 @@ private function drawLinesSeperatingColumns($format, $default_font)
$FilePath = $this->bread->temp_dir() . DIRECTORY_SEPARATOR . $this->get_FilePath('_column');
$mpdf_column->Output($FilePath, 'F');
$pagecount = $this->mpdf->SetSourceFile($FilePath);
- $tplId = $this->mpdf->importPage($pagecount);
+ $tplId = $this->mpdf->ImportPage($pagecount);
$this->mpdf->SetPageTemplate($tplId);
}
private function addFontOptions(array $options): array
@@ -579,7 +576,6 @@ private function reorder_booklet_pages()
$tplIdx = $mpdftmp->importPage(1);
$mpdftmp->UseTemplate($tplIdx, 0, 0);
$mpdftmp->UseTemplate($tplIdx, 0, $fh);
- $sep = $this->columnSeparators($oh);
$mpdftmp->AddPage($orientation);
$tplIdx = $mpdftmp->ImportPage(2);
$mpdftmp->UseTemplate($tplIdx, 0, 0);
@@ -661,7 +657,7 @@ private function get_FilePath($pos = '')
}
private function columnSeparators($oh)
{
- if ($this->options['column_line'] == 1) {
+ if ($this->options['column_line']) {
return '
diff --git a/readme.txt b/readme.txt
index 0df194a1..86e36411 100644
--- a/readme.txt
+++ b/readme.txt
@@ -58,6 +58,8 @@ Follow all these steps, keep in mind that once you start using bread, it's not g
= 2.10.5 =
* Booklets can have 2 columns per page.
* Formats table can have single format per row.
+* Fix problem where column separator lines were not printing.
+* Checkboxes consistently represented by booleans.
= 2.10.4 =
* Fix wizard crashing (#253)
diff --git a/tests/BreadMeetinglistStructureTest.php b/tests/BreadMeetinglistStructureTest.php
index 2ba6b4d5..d9b461ad 100644
--- a/tests/BreadMeetinglistStructureTest.php
+++ b/tests/BreadMeetinglistStructureTest.php
@@ -40,14 +40,13 @@ public function calculateExpectedHeadingStyle($options): string
$header_style .= "font-size:" . $options['header_font_size'] . "pt;";
$header_style .= "line-height:" . $options['content_line_height'] . ";";
$header_style .= "text-align:center;padding-top:2px;padding-bottom:3px;";
- if ($options['header_uppercase'] == 1) {
+ if ($options['header_uppercase']) {
$header_style .= 'text-transform: uppercase;';
}
- if ($options['header_bold'] == 0) {
- $header_style .= 'font-weight: normal;';
- }
- if ($options['header_bold'] == 1) {
+ if ($options['header_bold']) {
$header_style .= 'font-weight: bold;';
+ } else {
+ $header_style .= 'font-weight: normal;';
}
return $header_style;
}
From 4f27f0161258b8deaa1aa762b3adc590e3dc0be5 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 3 Aug 2026 15:59:04 +0200
Subject: [PATCH 3/4] lint
---
public/class-bread-public.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/class-bread-public.php b/public/class-bread-public.php
index 7e46c08e..91135e4a 100644
--- a/public/class-bread-public.php
+++ b/public/class-bread-public.php
@@ -242,7 +242,7 @@ public function bmlt_meeting_list()
$header_stylesheet = (new WP_Filesystem_Direct(null))->get_contents(plugin_dir_path(__FILE__) . 'css/mpdfstyletables.css');
$this->mpdf->WriteHTML($header_stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['content_line_height']);
- if ($this->options['column_line'] && ($this->options['page_fold'] === 'tri' || $this->options['page_fold'] === 'quad') ) {
+ if ($this->options['column_line'] && ($this->options['page_fold'] === 'tri' || $this->options['page_fold'] === 'quad')) {
$this->drawLinesSeperatingColumns($mpdf_init_options['format'], $default_font);
}
$result = $this->bread->bmlt()->doMainQuery();
From e495e567bbff65e51dfc63c75f0c2778ad28ad0d Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Wed, 5 Aug 2026 18:51:28 +0200
Subject: [PATCH 4/4] small fix to remove_space
---
admin/class-bread-admin.php | 2 +-
public/class-bread-meeting-enhancer.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/admin/class-bread-admin.php b/admin/class-bread-admin.php
index 77c6b27a..81b27925 100644
--- a/admin/class-bread-admin.php
+++ b/admin/class-bread-admin.php
@@ -701,7 +701,7 @@ function process_customize_form()
$this->bread->setOption('wheelchair_size', sanitize_text_field($_POST['wheelchair_size']));
$this->bread->setOption('time_clock', sanitize_text_field($_POST['time_clock']));
$this->bread->setOption('time_option', intval($_POST['time_option']));
- $this->bread->setOption('remove_space', boolval($_POST['remove_space']));
+ $this->bread->setOption('remove_space', boolval($_POST['remove_space'])); // It's a radio button, not a checkbox, so we can't just check isset
$this->bread->setOption('content_line_height', floatval($_POST['content_line_height']));
$this->bread->setOption('root_server', sanitize_url($_POST['root_server']));
$this->bread->setOption('service_bodies', isset($_POST['service_bodies']) ? array_map('sanitize_text_field', $_POST['service_bodies']) : array());
diff --git a/public/class-bread-meeting-enhancer.php b/public/class-bread-meeting-enhancer.php
index 40029fe7..15cfb6a9 100644
--- a/public/class-bread-meeting-enhancer.php
+++ b/public/class-bread-meeting-enhancer.php
@@ -28,7 +28,7 @@ public function enhance_meeting(&$meeting_value, $lang, $formatsManager, $format
$meeting_value['duration_m'] = $minutes;
$meeting_value['duration_h'] = rtrim(rtrim(number_format($minutes / 60, 2), 0), '.');
$space = ' ';
- if ($this->options['remove_space'] == 1) {
+ if ($this->options['remove_space']) {
$space = '';
}
if ($this->options['time_clock'] == null || $this->options['time_clock'] == '12' || $this->options['time_option'] == '') {