[format_codes_used_basic]');
}
},
+ {
+ text: 'Used Format Codes - Abbreviated - Same language as weekdays text/ Single Format per Row',
+ onclick: function () {
+ editor.insertContent('
Meeting Format Legend
[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('
Meeting Format Legend
[format_codes_all_detailed]
');
}
},
+ {
+ text: 'All Format Codes - Abbreviated - Same language as weekdays text/ Single Format per Row',
+ onclick: function () {
+ editor.insertContent('
Meeting Format Legend
[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-bmlt.php b/includes/class-bread-bmlt.php
index 722f8ac4..2ad7184e 100644
--- a/includes/class-bread-bmlt.php
+++ b/includes/class-bread-bmlt.php
@@ -52,7 +52,7 @@ private function get(string $url): WP_Error | array
'User-Agent' => $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; $ibread->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 73cdbdc4..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);
@@ -696,13 +696,14 @@ 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');
$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');
@@ -712,28 +713,33 @@ 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']) {
+ $this->fillUnsetStringOption('protection_password', '');
+ } else {
+ $this->options['protection_password'] = '';
+ }
$this->fillUnsetStringOption('protection_password', '');
$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', []);
@@ -779,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";
}
@@ -810,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'];
@@ -878,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 46a1d083..dbed7865 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -189,15 +189,17 @@ 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($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('');
}
@@ -205,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') {
@@ -337,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);
}
/**
@@ -364,9 +366,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 +410,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 +538,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 +557,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 .= "