Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bmlt-meeting-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand All @@ -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.
Expand Down
26 changes: 21 additions & 5 deletions public/class-bread-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,21 @@ 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') {
Expand All @@ -471,6 +486,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';
Expand All @@ -479,7 +495,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;
Expand All @@ -503,7 +518,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(),
Expand All @@ -516,10 +530,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);
Expand All @@ -539,6 +551,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(),
Expand All @@ -552,6 +565,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;
Expand All @@ -572,6 +586,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(),
Expand All @@ -585,6 +600,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);
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading