Skip to content

Commit eb6f536

Browse files
authored
Merge pull request #239 from bmlt-enabled/pocket-size
Add pocket guide size (11in x 4.25in)
2 parents de45ab6 + bf6400b commit eb6f536

File tree

77 files changed

+3482
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3482
-647
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ Makefile export-ignore
1111
/.github export-ignore
1212
.phpcs.xml export-ignore
1313
simplify-mpdf.sh export-ignore
14+
/tests export-ignore
15+
/tests/** export-ignore

.github/workflows/pull-requests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
unzip "${BUILD_DIR}/${ZIP_FILENAME}" -d "./bread"
3333
3434
- name: Run plugin check
35-
uses: wordpress/plugin-check-action@v1.0.6
35+
uses: wordpress/plugin-check-action@v1
3636
with:
3737
build-dir: "./bread"
3838
exclude-directories: 'vendor'
File renamed without changes.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM wordpress:6.2.2-php8.2-apache
1+
FROM wordpress:6.9.0-php8.2-apache
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends ssl-cert && \

admin/class-bmltenabled-admin.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
2-
2+
if (! defined('ABSPATH')) {
3+
exit;
4+
}
35
/**
46
* Creates the main item in the admin menu, where both bread and crouton admins can live.
57
*
@@ -39,6 +41,9 @@ function admin_menu_link()
3941
if (!current_user_can($cap)) {
4042
$cap = 'manage_bread';
4143
}
44+
// The prefix "BmltEnabled" is correct: it is unique enough to avoid conflicts and the filter is shared
45+
// with other plugins from this author
46+
// phpcs:ignore
4247
$icon = apply_filters("BmltEnabled_IconSVG", 'dashicons-location-alt');
4348
add_menu_page(
4449
'Meeting Lists',
@@ -49,6 +54,9 @@ function admin_menu_link()
4954
$icon,
5055
null
5156
);
57+
// The prefix "BmltEnabled" is correct: it is unique enough to avoid conflicts and the filter is shared
58+
// with other plugins from this author
59+
// phpcs:ignore
5260
do_action('BmltEnabled_Submenu', $this->slug);
5361
}
5462
}

admin/class-bread-admin.php

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
2-
2+
if (! defined('ABSPATH')) {
3+
exit;
4+
}
35
/**
46
* The admin-specific functionality of the plugin.
57
*
@@ -14,6 +16,7 @@
1416
* @subpackage Bread/admin
1517
* @author bmlt-enabled <help@bmlt.app>
1618
*/
19+
include_once plugin_dir_path(__FILE__) . 'partials/_meeting_list_setup.php';
1720
class Bread_Admin
1821
{
1922

@@ -66,13 +69,14 @@ public function enqueue_styles($hook)
6669
if (!str_ends_with($hook, $this->hook)) {
6770
return;
6871
}
69-
wp_enqueue_style("jquery-ui", plugin_dir_url(__FILE__) . "css/jquery-ui.min.css", false, "1.2", 'all');
70-
wp_enqueue_style("spectrum", plugin_dir_url(__FILE__) . "css/spectrum.min.css", false, "1.2", 'all');
71-
wp_enqueue_style("tooltipster", plugin_dir_url(__FILE__) . "css/tooltipster.bundle.min.css", false, "1.2", 'all');
72-
wp_enqueue_style("tooltipster-noir", plugin_dir_url(__FILE__) . "css/tooltipster-sideTip-noir.min.css", false, "1.2", 'all');
73-
wp_enqueue_style("admin", plugin_dir_url(__FILE__) . "css/admin.css", false, "1.2", 'all');
74-
wp_enqueue_style("chosen", plugin_dir_url(__FILE__) . "css/chosen.min.css", false, "1.2", 'all');
75-
wp_enqueue_style("smartWizard-dots", plugin_dir_url(__FILE__) . "css/smart_wizard_dots.css", false, "6.0.6", 'all');
72+
wp_enqueue_style("jquery-ui", plugin_dir_url(__FILE__) . "css/jquery-ui.min.css", false, BREAD_VERSION, 'all');
73+
wp_enqueue_style("spectrum", plugin_dir_url(__FILE__) . "css/spectrum.min.css", false, BREAD_VERSION, 'all');
74+
wp_enqueue_style("tooltipster", plugin_dir_url(__FILE__) . "css/tooltipster.bundle.min.css", false, BREAD_VERSION, 'all');
75+
wp_enqueue_style("tooltipster-noir", plugin_dir_url(__FILE__) . "css/tooltipster-sideTip-noir.min.css", false, BREAD_VERSION, 'all');
76+
wp_enqueue_style("admin", plugin_dir_url(__FILE__) . "css/admin.css", false, BREAD_VERSION, 'all');
77+
wp_enqueue_style("bread-fonts", plugin_dir_url(__FILE__) . "css/admin-fonts.css", false, BREAD_VERSION, 'all');
78+
wp_enqueue_style("select2", plugin_dir_url(__FILE__) . "css/select2.min.css", false, BREAD_VERSION, 'all');
79+
wp_enqueue_style("smartWizard-dots", plugin_dir_url(__FILE__) . "css/smart_wizard_dots.css", false, BREAD_VERSION, 'all');
7680
}
7781

7882
/**
@@ -89,13 +93,13 @@ public function enqueue_scripts($hook)
8993
wp_enqueue_script('jquery-ui-tabs');
9094
wp_enqueue_script('jquery-ui-accordion');
9195
wp_enqueue_script('jquery-ui-dialog');
92-
wp_enqueue_script("bmlt_meeting_list", plugin_dir_url(__FILE__) . "js/bmlt_meeting_list.js", array('jquery'), "2.8.0", true);
96+
wp_enqueue_script("bmlt_meeting_list", plugin_dir_url(__FILE__) . "js/bmlt_meeting_list.js", array('jquery'), BREAD_VERSION, true);
9397
wp_enqueue_script("tooltipster", plugin_dir_url(__FILE__) . "js/tooltipster.bundle.min.js", array('jquery'), "1.2", true);
9498
wp_enqueue_script("spectrum", plugin_dir_url(__FILE__) . "js/spectrum.min.js", array('jquery'), "1.2", true);
95-
wp_enqueue_script("chosen", plugin_dir_url(__FILE__) . "js/chosen.jquery.min.js", array('jquery'), "1.2", true);
99+
wp_enqueue_script("select2", plugin_dir_url(__FILE__) . "js/select2.min.js", array('jquery'), "1.2", true);
96100
wp_enqueue_script("fetch-jsonp", plugin_dir_url(__FILE__) . "js/fetch-jsonp.js", array('jquery'), "1.30", true);
97101
wp_enqueue_script("smartWizard", plugin_dir_url(__FILE__) . "js/jquery.smartWizard.js", array('jquery'), "6.0.6", true);
98-
wp_enqueue_script("breadWizard", plugin_dir_url(__FILE__) . "js/bread-wizard.js", array('smartWizard'), "2.8.0", true);
102+
wp_enqueue_script("breadWizard", plugin_dir_url(__FILE__) . "js/bread-wizard.js", array('smartWizard'), BREAD_VERSION, true);
99103
/**
100104
* Make some JSON from PHP available in JS.
101105
*/
@@ -204,10 +208,22 @@ function tiny_tweaks($initArray)
204208
$initArray['fontsize_formats'] = "5pt 6pt 7pt 8pt 9pt 10pt 11pt 12pt 13pt 14pt 15pt 16pt 17pt 18pt 19pt 20pt 22pt 24pt 26pt 28pt 30pt 32pt 34pt 36pt 38pt";
205209
$initArray['theme_advanced_blockformats'] = 'h2,h3,h4,p';
206210
$initArray['wordpress_adv_hidden'] = false;
207-
$initArray['font_formats'] = 'Arial (Default)=arial;';
211+
$initArray['font_formats'] = 'Arial (Sans-Serif)=arial;';
208212
$initArray['font_formats'] .= 'Times (Sans-Serif)=times;';
209213
$initArray['font_formats'] .= 'Courier (Monospace)=courier;';
210-
$initArray['content_style'] = 'body { font-family: Arial; }';
214+
$initArray['font_formats'] .= 'DejaVu (Sans-Serif)=DejaVuSansCondensed;';
215+
$dir = plugin_dir_url(__FILE__);
216+
$font = $this->bread->getOption('base_font');
217+
if ($font == 'dejavusanscondensed') {
218+
$initArray['content_style'] = "@import url('$dir/css/fonts.css'); body { font-family: DejaVuSansCondensed; }";
219+
} elseif ($font == 'times') {
220+
$initArray['content_style'] = "@import url('$dir/css/fonts.css'); body { font-family: Times; }";
221+
} elseif ($font == 'courier') {
222+
$initArray['content_style'] = "@import url('$dir/css/fonts.css'); body { font-family: Courier; }";
223+
} else {
224+
$initArray['content_style'] = "@import url('$dir/css/fonts.css'); body { font-family: Arial; }";
225+
}
226+
//$initArray['content_style'] = "body { font-family: Arial; }";
211227
}
212228
}
213229
return $initArray;
@@ -248,9 +264,6 @@ function pwsix_process_settings_export()
248264
if (!isset($_POST['pwsix_export_nonce']) || ! wp_verify_nonce($_POST['pwsix_export_nonce'], 'pwsix_export_nonce')) {
249265
return;
250266
}
251-
if (! current_user_can('manage_bread')) { // TODO: Is this necessary? Why not let the user make a copy
252-
return;
253-
}
254267
$this->download_settings_inner();
255268
}
256269
function download_settings()
@@ -317,13 +330,13 @@ function exportLogFile($file)
317330
}
318331
function current_user_can_modify()
319332
{
320-
if (! current_user_can('manage_bread')) {
321-
return false;
322-
}
323333
$user = wp_get_current_user();
324334
if (in_array('administrator', $user->roles)) {
325335
return true;
326336
}
337+
if (! current_user_can('manage_bread')) {
338+
return false;
339+
}
327340
$authors_safe = $this->bread->getOption('authors');
328341
if (!is_array($authors_safe) || empty($authors_safe)) {
329342
return true;
@@ -335,10 +348,17 @@ function current_user_can_modify()
335348
}
336349
function current_user_can_create()
337350
{
338-
if (! current_user_can('manage_bread')) {
339-
return false;
351+
$user = wp_get_current_user();
352+
if (in_array('administrator', $user->roles)) {
353+
return true;
354+
}
355+
if (current_user_can('manage_options')) {
356+
return true;
340357
}
341-
return true;
358+
if (current_user_can('manage_bread')) {
359+
return true;
360+
}
361+
return false;
342362
}
343363
/**
344364
* Process a settings import from a json file
@@ -348,7 +368,7 @@ function pwsix_process_settings_import()
348368
if (empty($_REQUEST['pwsix_import_nonce']) || !wp_verify_nonce($_REQUEST['pwsix_import_nonce'], 'pwsix_import_nonce')) {
349369
return;
350370
}
351-
if (! current_user_can('manage_bread')) {
371+
if (! $this->current_user_can_modify()) {
352372
return;
353373
}
354374
$this->bread->getConfigurationForSettingId($this->bread->getRequestedSetting());
@@ -376,7 +396,7 @@ function pwsix_process_settings_import()
376396
update_option($this->bread->getOptionsName(), $this->bread->getOptions());
377397
setcookie('current-meeting-list', $this->bread->getRequestedSetting(), time() + 10);
378398
setcookie('bread_import_file', $import_file, time() + 10);
379-
wp_safe_redirect(admin_url('?page=class-bread-admin.php'));
399+
wp_safe_redirect(admin_url('?page=bmlt-enabled-bread'));
380400
}
381401
function my_theme_add_editor_styles()
382402
{
@@ -430,14 +450,18 @@ function get($url, $cookies = array())
430450
*/
431451
function admin_submenu_link($parent_slug)
432452
{
433-
activate_bread();
453+
Bread_activate();
434454
$this->bmltEnabled_admin->createMenu();
435455

456+
$cap = 'manage_options';
457+
if (!current_user_can($cap)) {
458+
$cap = 'manage_bread';
459+
}
436460
$this->hook = add_submenu_page(
437461
$parent_slug,
438462
'Printable Meeting Lists',
439463
'Printable Meeting Lists',
440-
'manage_bread',
464+
$cap,
441465
'bmlt-enabled-bread',
442466
array(&$this, 'admin_options_page'),
443467
2

admin/css/admin-fonts.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@font-face {
2+
font-family:'DejaVuSansCondensed';
3+
src:url(../../vendor/mpdf/mpdf/ttfonts/DejaVuSansCondensed.ttf) format('truetype');
4+
font-display: block;
5+
}
6+
@font-face {
7+
font-family:'DejaVuSansCondensed';
8+
src:url(../../vendor/mpdf/mpdf/ttfonts/DejaVuSansCondensed-Bold.ttf) format('truetype');
9+
font-display: block;
10+
font-weight: bold;
11+
}
12+
@font-face {
13+
font-family:'DejaVuSansCondensed';
14+
src:url(../../vendor/mpdf/mpdf/ttfonts/DejaVuSansCondensed-BoldOblique.ttf) format('truetype');
15+
font-display: block;
16+
font-weight: bold;
17+
font-style: italic;
18+
}
19+
@font-face {
20+
font-family:'DejaVuSansCondensed';
21+
src:url(../../vendor/mpdf/mpdf/ttfonts/DejaVuSansCondensed-Oblique.ttf) format('truetype');
22+
font-display: block;
23+
font-style: italic;
24+
}

0 commit comments

Comments
 (0)