diff --git a/.gitignore b/.gitignore
index 82a38be..1b35e12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
.idea
logs
mpdf/vendor
+.vscode/*
diff --git a/bmlt-meeting-list.php b/bmlt-meeting-list.php
index c9f05d0..bbf9b2f 100644
--- a/bmlt-meeting-list.php
+++ b/bmlt-meeting-list.php
@@ -5,7 +5,7 @@
Description: Maintains and generates a PDF Meeting List from BMLT.
Author: bmlt-enabled
Author URI: https://bmlt.app
-Version: 1.10.1
+Version: 2.0.0
*/
/* Disallow direct access to the plugin file */
use Mpdf\Mpdf;
@@ -22,40 +22,154 @@ class Bread {
var $mpdf = '';
var $meeting_count = 0;
var $formats_used = '';
+ var $formats_by_key = '';
var $formats_spanish = '';
var $formats_all = '';
-
+ var $meeting_fields = array (
+ 'id_bigint',
+ 'service_body_bigint',
+ 'weekday_tinyint',
+ 'start_time',
+ 'duration_time',
+ 'formats',
+ 'email_contact',
+ 'comments',
+ 'location_city_subsection',
+ 'location_nation',
+ 'location_postal_code_1',
+ 'location_province',
+ 'location_sub_province',
+ 'location_municipality',
+ 'location_neighborhood',
+ 'location_street',
+ 'location_info',
+ 'location_text',
+ 'meeting_name',
+ 'bus_lines',
+ 'format_shared_id_list'
+ );
+ var $calculated_fields = array(
+ 'duration_m',
+ 'duration_h',
+ 'day',
+ 'day_abbr',
+ 'area_name',
+ );
+ var $legacy_synonyms = array (
+ 'borough' => 'location_city_subsection',
+ 'time' => 'start_time',
+ 'state' => 'location_province',
+ 'street' => 'location_street',
+ 'neighborhood' => 'location_neighborhood',
+ 'city' => 'location_municipality',
+ 'zip' => 'location_postal_code_1',
+ 'location' => 'location_text',
+ 'info' => 'location_info',
+ 'county' => 'location_sub_province',
+ 'group' => 'meeting_name',
+ 'email' => 'email_contact',
+ 'mins' => 'duration_m',
+ 'hrs' => 'duration_h',
+ "area" => 'area_name',
+ );
+ var $section_shortcodes;
var $service_meeting_result ='';
- var $optionsName = 'bmlt_meeting_list_options';
+ const SETTINGS = 'bmlt_meeting_list_settings';
+ const OPTIONS_NAME = 'bmlt_meeting_list_options';
+ var $optionsName = Bread::OPTIONS_NAME;
var $options = array();
+ var $outside_meeting_result = array();
+ var $allSettings = array();
+ var $maxSetting = 1;
+ var $loaded_setting = 1;
+ var $authors_safe = array();
+
+ function loadAllSettings() {
+ $this->allSettings = get_option( Bread::SETTINGS );
+ if ($this->allSettings === false) {
+ $this->allSettings = array();
+ $this->allSettings[1] = "Default Setting";
+ $this->maxSetting = 1;
+ } else {
+ foreach ($this->allSettings as $key => $value ) {
+ if ($key > $this->maxSetting) {
+ $this->maxSetting = $key;
+ }
+ }
+ }
+ }
+ function startsWith($haystack, $needle)
+ {
+ $length = strlen($needle);
+ return (substr($haystack, 0, $length) === $needle);
+ }
+ function getCurrentMeetingListHolder() {
+ $ret = array();
+ if (isset($_REQUEST['current-meeting-list'])) {
+ $ret['current-meeting-list'] = $_REQUEST['current-meeting-list'];
+ } else if (isset($_COOKIE['current-meeting-list'])) {
+ $ret['current-meeting-list'] = $_COOKIE['current-meeting-list'];
+ }
+ return $ret;
+ }
function __construct() {
- $this->protocol = (strpos(strtolower(home_url()), "https") !== false ? "https" : "http") . "://";
- if (is_admin() || (isset($_GET['current-meeting-list']) && intval($_GET['current-meeting-list']) == 1)) {
- $this->getMLOptions();
- $this->lang = $this->get_bmlt_server_lang();
-
- if (is_admin()) {
- // Back end
- //Initialize the options
- add_action("admin_init", array(&$this, 'my_sideload_image'));
- add_action("admin_menu", array(&$this, "admin_menu_link"));
- add_filter('tiny_mce_before_init', array(&$this, 'tiny_tweaks' ));
- add_filter('mce_external_plugins', array(&$this, 'my_custom_plugins'));
- add_filter('mce_buttons', array(&$this, 'my_register_mce_button'));
- add_action("admin_notices", array(&$this, "is_root_server_missing"));
- add_action("admin_init", array(&$this, "pwsix_process_settings_export"));
- add_action("admin_init", array(&$this, "pwsix_process_settings_import"));
- add_action("admin_init", array(&$this, "pwsix_process_default_settings"));
- add_action("admin_init", array(&$this, "my_theme_add_editor_styles"));
- add_action("admin_enqueue_scripts", array(&$this, "enqueue_backend_files"));
- add_action("wp_default_editor", array(&$this, "ml_default_editor"));
- add_filter('tiny_mce_version', array( __CLASS__, 'force_mce_refresh' ) );
- } else if ( intval($_GET['current-meeting-list']) == 1 ) {
- $this->bmlt_meeting_list();
- }
+ // Register hooks
+ register_activation_hook(__FILE__, array(__CLASS__, 'activation'));
+
+ $this->protocol = (strpos(strtolower(home_url()), "https") !== false ? "https" : "http") . "://";
+
+ $this->loadAllSettings();
+ $holder = $this->getCurrentMeetingListHolder();
+
+ $current_settings = isset($holder['current-meeting-list']) ? intval($holder['current-meeting-list']) : 1;
+ $this->getMLOptions($current_settings);
+ $this->lang = $this->get_bmlt_server_lang();
+
+ if (isset($holder['current-meeting-list']) && !is_admin()) {
+ $this->bmlt_meeting_list();
+ } else if (is_admin()) {
+ add_action("admin_init", array(&$this, 'my_sideload_image'));
+ add_action("admin_menu", array(&$this, "admin_menu_link"));
+ add_filter('tiny_mce_before_init', array(&$this, 'tiny_tweaks'));
+ add_filter('mce_external_plugins', array(&$this, 'my_custom_plugins'));
+ add_filter('mce_buttons', array(&$this, 'my_register_mce_button'));
+ add_action("admin_notices", array(&$this, "is_root_server_missing"));
+ add_action("admin_init", array(&$this, "pwsix_process_settings_export"));
+ add_action("admin_init", array(&$this, "pwsix_process_settings_import"));
+ add_action("admin_init", array(&$this, "pwsix_process_default_settings"));
+ add_action("admin_init", array(&$this, "pwsix_process_settings_admin"));
+ add_action("admin_init", array(&$this, "pwsix_process_rename_settings"));
+ add_action("admin_init", array(&$this, "my_theme_add_editor_styles"));
+ add_action("admin_enqueue_scripts", array(&$this, "enqueue_backend_files"));
+ add_action("wp_default_editor", array(&$this, "ml_default_editor"));
+ add_filter('tiny_mce_version', array(__CLASS__, 'force_mce_refresh'));
}
+
+ register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivation'));
}
+ public function activation() {
+ Bread::add_cap();
+ }
+
+ private static function add_cap() {
+ $role = $GLOBALS['wp_roles']->role_objects['administrator'];
+ if (isset($role) && !$role->has_cap('manage_bread')) {
+ $role->add_cap('manage_bread');
+ }
+ }
+
+ public function deactivation() {
+ Bread::remove_cap();
+ }
+
+ private static function remove_cap() {
+ $role = $GLOBALS['wp_roles']->role_objects['administrator'];
+ if (isset($role) && $role->has_cap('manage_bread')) {
+ $role->remove_cap('manage_bread');
+ }
+ }
+
function ml_default_editor() {
global $my_admin_page;
$screen = get_current_screen();
@@ -97,12 +211,18 @@ function my_custom_plugins () {
global $my_admin_page;
$screen = get_current_screen();
if ( $screen->id == $my_admin_page ) {
- $plugins = array('table', 'front_page_button', 'code', 'contextmenu' ); //Add any more plugins you want to load here
+ $plugins = array('table', 'code', 'contextmenu' ); //Add any more plugins you want to load here
$plugins_array = array();
//Build the response - the key is the plugin name, value is the URL to the plugin JS
foreach ($plugins as $plugin ) {
$plugins_array[ $plugin ] = plugins_url('tinymce/', __FILE__) . $plugin . '/plugin.min.js';
}
+ $shortcode_menu = array();
+ $shortcode_menu['front_page_button'] = plugins_url('tinymce/', __FILE__) . 'front_page_button/plugin.min.js';
+ //let's leave the enhancement mechanism open for now.
+ //apply_filters is one option, perhaps we will think of something better.
+ //$shortcode_menu = apply_filters("Bread_Adjust_Menu", $shortcode_menu);
+ $plugins_array = array_merge($plugins_array, $shortcode_menu);
}
return $plugins_array;
}
@@ -209,7 +329,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Sön" : "Söndag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "Sø" : "Søndag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'So.' : "Sonntag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding ('یَکشَنبه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 2 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Mon' : "Monday");
@@ -229,7 +353,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Mån" : "Måndag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "Ma" : "Mandag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Mo.' : "Montag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding ('دوشَنبه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 3 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Tue' : "Tuesday");
@@ -249,7 +377,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Tis" : "Tisdag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "Ti" : "Tirsdag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Di.' : "Dienstag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding('سهشنبه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 4 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Wed' : "Wednesday");
@@ -269,7 +401,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Ons" : "Onsdag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "On" : "Onsdag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Mi.' : "Mittwoch");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding('چهار شنبه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 5 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Thu' : "Thursday");
@@ -289,7 +425,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Tors" : "Torsdag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "To" : "Torsdag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Do.' : "Donnerstag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding ('پَنج شَنبه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 6 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Fri' : "Friday");
@@ -309,7 +449,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Fre" : "Fredag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "Fr" : "Fredag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Fr.' : "Freitag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding ('جُمعه', 'HTML-ENTITIES'));
+ }
} elseif ( $day == 7 ) {
if ( $language == 'en' || $language == 'en' ) {
$data = ($abbreviate ? 'Sat' : "Saturday");
@@ -329,7 +473,11 @@ function getday( $day, $abbreviate = false, $language = '') {
$data = ($abbreviate ? "Lör" : "Lördag");
} elseif ( $language == 'dk') {
$data = ($abbreviate ? "Lø" : "Lørdag");
- }
+ } elseif ( $language == 'de' ) {
+ $data = ($abbreviate ? 'Sa.' : "Samstag");
+ } elseif ( $language == 'fa' ) {
+ $data = ($abbreviate ? '' : mb_convert_encoding ('شَنبه', 'HTML-ENTITIES'));
+ }
}
Return utf8_encode($data);
@@ -342,11 +490,14 @@ function authenticate_root_server() {
'c_comdef_admin_password' => $this->options['bmlt_login_password'], '&'));
return $this->get($this->options['root_server']."/local_server/server_admin/xml.php?" . $query_string);
}
-
+ function requires_authentication() {
+ return $this->options['asm_logged_in'] &&
+ ($this->options['include_meeting_email'] == 1 || $this->options['include_asm'] == 1);
+ }
function get_root_server_request($url) {
$cookies = null;
- if ($this->options['include_meeting_email'] == 1 || $this->options['include_asm'] == 1) {
+ if ($this->requires_authentication()) {
$auth_response = $this->authenticate_root_server();
$cookies = wp_remote_retrieve_cookies($auth_response);
}
@@ -369,12 +520,11 @@ function get($url, $cookies = null) {
return wp_remote_get($url, $args);
}
-
function get_all_meetings() {
$results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults&data_field_key=weekday_tinyint,start_time,service_body_bigint,id_bigint,meeting_name,location_text,email_contact&sort_keys=meeting_name,service_body_bigint,weekday_tinyint,start_time");
$result = json_decode(wp_remote_retrieve_body($results),true);
- $unique_areas = $this->get_areas();
+ $unique_areas = $this->get_areas();
$all_meetings = array();
foreach ($result as $value) {
foreach($unique_areas as $unique_area){
@@ -383,7 +533,7 @@ function get_all_meetings() {
if ( $area_id === $value['service_body_bigint'] ) {
$area_name = $area_data[0];
}
- }
+ }
$value['start_time'] = date("g:iA",strtotime($value['start_time']));
$all_meetings[] = $value['meeting_name'].'||| ['.$this->getday($value['weekday_tinyint'], true, $this->lang).'] ['.$value['start_time'].']||| ['.$area_name.']||| ['.$value['id_bigint'].']';
@@ -437,7 +587,9 @@ function testRootServer($override_root_server = null) {
$results = $results["serverVersion"]["readableString"];
return $results;
}
-
+ function require_service_meetings() {
+ return strpos($this->options['custom_section_content'].$this->options['front_page_content'].$this->options['last_page_content'], "[service_meetings]") !== false;
+ }
function getUsedFormats() {
if ( !isset($this->options['recurse_service_bodies']) ) {$this->options['recurse_service_bodies'] = 1;}
$area_data = explode(',',$this->options['service_body_1']);
@@ -556,6 +708,7 @@ function bmlt_meeting_list($atts = null, $content = null) {
if ( !isset($this->options['margin_left']) ) {$this->options['margin_left'] = 3;}
if ( !isset($this->options['margin_bottom']) ) {$this->options['margin_bottom'] = 3;}
if ( !isset($this->options['margin_top']) ) {$this->options['margin_top'] = 3;}
+ if ( !isset($this->options['margin_header']) ) {$this->options['margin_header'] = 3;}
if ( !isset($this->options['page_size']) ) {$this->options['page_size'] = 'legal';}
if ( !isset($this->options['page_orientation']) ) {$this->options['page_orientation'] = 'L';}
if ( !isset($this->options['page_fold']) ) {$this->options['page_fold'] = 'quad';}
@@ -576,6 +729,8 @@ function bmlt_meeting_list($atts = null, $content = null) {
if ( !isset($this->options['weekday_language']) ) {$this->options['weekday_language'] = 'en';}
if ( !isset($this->options['weekday_start']) ) {$this->options['weekday_start'] = '1';}
if ( !isset($this->options['include_asm']) ) {$this->options['include_asm'] = '0';}
+ if ( !isset($this->options['asm_format_key']) ) {$this->options['asm_format_key'] = 'ASM';}
+ if ( !isset($this->options['asm_sort_order']) ) {$this->options['asm_sort_order'] = 'name';}
if ( !isset($this->options['header_uppercase']) ) {$this->options['header_uppercase'] = '0';}
if ( !isset($this->options['header_bold']) ) {$this->options['header_bold'] = '1';}
if ( !isset($this->options['sub_header_shown']) ) {$this->options['sub_header_shown'] = '1';}
@@ -607,7 +762,9 @@ function bmlt_meeting_list($atts = null, $content = null) {
if ( $this->options['page_fold'] == 'half' && $this->options['page_size'] == '5inch' ) {
$page_type_settings = ['format' => array(197.2,279.4), 'margin_footer' => 5];
} elseif ( $this->options['page_fold'] == 'half' && $this->options['page_size'] == 'A5' ) {
- $page_type_settings = ['format' => 'A5', 'margin_footer' => 5];
+ $page_type_settings = ['format' => 'A5', 'margin_footer' => 5];
+ } elseif ( $this->options['page_fold'] == 'half' && $this->options['page_size'] == 'A6' ) {
+ $page_type_settings = ['format' => 'A6', 'margin_footer' => 5];
} elseif ( $this->options['page_size'] . '-' .$this->options['page_orientation'] == 'ledger-L' ) {
$page_type_settings = ['format' => array(432,279), 'margin_footer' => 0];
} elseif ( $this->options['page_size'] . '-' .$this->options['page_orientation'] == 'ledger-P' ) {
@@ -652,6 +809,7 @@ function bmlt_meeting_list($atts = null, $content = null) {
'margin_right' => $this->options['margin_right'],
'margin_top' => $this->options['margin_top'],
'margin_bottom' => $this->options['margin_bottom'],
+ 'margin_header' => $this->options['margin_header'],
'orientation' => 'P'
];
}
@@ -665,6 +823,7 @@ function bmlt_meeting_list($atts = null, $content = null) {
'margin_right' => $this->options['margin_right'],
'margin_top' => $this->options['margin_top'],
'margin_bottom' => $this->options['margin_bottom'],
+ 'margin_header' => $this->options['margin_header'],
'orientation' => 'P'
];
}
@@ -674,8 +833,12 @@ function bmlt_meeting_list($atts = null, $content = null) {
// TODO: Adding a page number really could just be an option or tag.
if ( $this->options['page_fold'] == 'half' &&
- ($this->options['page_size'] == '5inch' || $this->options['page_size'] == 'A5')) {
- $this->mpdf->DefHTMLFooterByName('MyFooter','
Page {PAGENO}
');
+ ($this->options['page_size'] == '5inch' || $this->options['page_size'] == 'A5' || $this->options['page_size'] == 'A6')) {
+ $page_string = "Page";
+ if ($this->options['weekday_language']=='de') {
+ $page_string = "Seite";
+ } //TODO: Other Languages
+ $this->mpdf->DefHTMLFooterByName('MyFooter',''.$page_string.' {PAGENO}
');
}
$this->mpdf->simpleTables = false;
@@ -736,9 +899,21 @@ function bmlt_meeting_list($atts = null, $content = null) {
$this->mpdf->SetPageTemplate($tplId);
unlink($FilePath);
}
-
- $data_field_keys = 'id_bigint,service_body_bigint,weekday_tinyint,start_time,duration_time,formats,email_contact,comments,location_city_subsection,location_nation,location_postal_code_1,location_province,location_sub_province,location_municipality,location_neighborhood,location_street,location_info,location_text,meeting_name,bus_lines,format_shared_id_list';
-
+ //let's leave the enhancement mechanism open for now.
+ //apply_filters is one option, perhaps we will think of something better.
+ //$meeting_fields = apply_filters("Bread_Meeting_Fields", $this->meeting_fields);
+ $data_field_keys = implode(',', $meeting_fields);
+ if (isset($this->options['pageheader_text'])) {
+ $this->mpdf->SetHTMLHeader('
+
+ '.$this->options['pageheader_text'].'
+
',
+ 'O');
+ }
+ if (isset($this->options['watermark'])) {
+ $this->mpdf->SetWatermarkImage($this->options['watermark'],0.2,'F');
+ $this->mpdf->showWatermarkImage = true;
+ }
if ( $this->options['meeting_sort'] == 'state' ) {
$sort_keys = 'location_province,location_municipality,weekday_tinyint,start_time,meeting_name';
} elseif ( $this->options['meeting_sort'] == 'city' ) {
@@ -810,11 +985,17 @@ function bmlt_meeting_list($atts = null, $content = null) {
echo 'No Meetings Found
Or
Internet or Server Problem
'.$this->options['root_server'].'
Please try again or contact your BMLT Administrator
';
exit;
}
- if ( strpos($this->options['custom_section_content'].$this->options['front_page_content'].$this->options['last_page_content'], "[service_meetings]") !== false ) {
- $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults$services_service_body_1&sort_keys=meeting_name&advanced_published=0" );
+ if ( $this->require_service_meetings() ) {
+ // Why not add a query string that limits to meetings having the desired format????
+ $asm_query = "client_interface/json/?switcher=GetSearchResults$services_service_body_1&sort_keys=$this->options['asm_sort_order']";
+ // I'm not sure we need this, but for now we need to emulate the old behavior
+ if ($this->options['asm_format_key']==='ASM') {
+ $asm_query .= "&advanced_published=0";
+ }
+ $results = $this->get_configured_root_server_request( $asm_query );
$this->service_meeting_result = json_decode(wp_remote_retrieve_body($results), true);
}
- $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats");
+ $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats&lang_enum=$this->options['weekday_language']");
$this->formats_all = json_decode(wp_remote_retrieve_body($results), true);
if ( strpos($this->options['custom_section_content'].$this->options['front_page_content'].$this->options['last_page_content'], '[format_codes_used_basic_es') !== false ) {
if ( $this->options['used_format_1'] == '' && $this->options['used_format_2'] == '' ) {
@@ -832,7 +1013,7 @@ function bmlt_meeting_list($atts = null, $content = null) {
if ( $this->options['include_asm'] === '0' ) {
$countmax = count ( $this->formats_used );
for ( $count = 0; $count < $countmax; $count++ ) {
- if ( $this->formats_used[$count]['key_string'] == 'ASM' ) {
+ if ( $this->formats_used[$count]['key_string'] == $this->options['asm_format_key'] ) {
unset($this->formats_used[$count]);
}
}
@@ -841,9 +1022,12 @@ function bmlt_meeting_list($atts = null, $content = null) {
$this->sortBySubkey($this->formats_used, 'key_string');
$this->sortBySubkey($this->formats_all, 'key_string');
- $this->uniqueFormat($this->formats_used, 'key_string');
+ $this->formats_by_key = array();
+ foreach($this->formats_all as $thisFormat) {
+ $this->formats_by_key[$thisFormat['key_string']] = $thisFormat;
+ }
+ $this->uniqueFormat($this->formats_used, 'key_string');
$this->uniqueFormat($this->formats_all, 'key_string');
-
$this->meeting_count = count($result_meetings);
$unique_areas = $this->get_areas();
$unique_states = array();
@@ -914,6 +1098,36 @@ function bmlt_meeting_list($atts = null, $content = null) {
$this->options['page_fold'] = 'quad';
$num_columns = 4;
}
+ $this->section_shortcodes = array(
+ '[meeting_count]' => $this->meeting_count,
+ '' => '',
+ ' [page_break]
' => ' ',
+ '[page_break]
' => ' ',
+ '[page_break]' => ' ',
+ '' => ' ',
+ "[area]" => strtoupper($this->options['service_body_1']),
+ '[new_column]
' => ' ',
+ '[new_column]
' => ' ',
+ '[new_column]' => ' ',
+ '[page_break no_page_number]' => ' ',
+ '[start_page_numbers]' => ' ',
+ "[month_lower]" => date ( "F" ),
+ "[month_upper]" => strtoupper( date ( "F" ) ),
+ "[month]" => strtoupper( date ( "F" ) ),
+ "[day]" => strtoupper( date ( "j" ) ),
+ "[year]" => strtoupper( date ( "Y" ) ),
+ "[service_body]" => strtoupper($this->options['service_body_1']),
+ "[service_body_1]" => strtoupper($this->options['service_body_1']),
+ "[service_body_2]" => strtoupper($this->options['service_body_2']),
+ "[service_body_3]" => strtoupper($this->options['service_body_3']),
+ "[service_body_4]" => strtoupper($this->options['service_body_4']),
+ "[service_body_5]" => strtoupper($this->options['service_body_5']),
+
+ );
+ //let's leave the enhancement mechanism open for now.
+ //apply_filters is one option, perhaps we will think of something better.
+ //$this->section_shortcodes = apply_filters("Bread_Section_Shortcodes",$this->section_shortcodes, $unique_areas, $this->formats_used);
+
$this->mpdf->SetColumns($num_columns, '', $this->options['column_gap']);
$header_style = "color:".$this->options['header_text_color'].";";
$header_style .= "background-color:".$this->options['header_background_color'].";";
@@ -1011,11 +1225,13 @@ function bmlt_meeting_list($atts = null, $content = null) {
}
if ( $this->options['meeting_sort'] === 'day' && $meeting_value['weekday_tinyint'] !== $this_unique_value ) { continue; }
$enFormats = explode ( ",", $meeting_value['formats'] );
- if ( $this->options['include_asm'] == 0 && in_array ( "ASM", $enFormats ) ) { continue; }
+ if ( $this->options['include_asm'] == 0 && in_array ( $this->options['asm_format_key'], $enFormats ) ) { continue; }
$header = '';
if ( $this->options['weekday_language'] === 'fr' ) {
$cont = '(suite)';
+ } else if ( $this->options['weekday_language'] == 'de') {
+ $cont = '(weiter)';
} else if ( $this->options['weekday_language'] === 'se' || $this->options['weekday_language'] === 'dk' ) {
$cont = '(forts)';
} else {
@@ -1141,127 +1357,9 @@ function bmlt_meeting_list($atts = null, $content = null) {
}
$newVal = false;
$newCol = false;
- $duration = explode(':', $meeting_value['duration_time']);
- $minutes = intval($duration[0])*60 + intval($duration[1]) + intval($duration[2]);
- $duration_m = $minutes;
- $duration_h = rtrim(rtrim(number_format($duration_m/60,2),0),'.');
- $space = ' ';
- if ( $this->options['remove_space'] == 1 ) {
- $space = '';
- }
- if ( $this->options['time_clock'] == null || $this->options['time_clock'] == '12' || $this->options['time_option'] == '' ) {
- $time_format = "g:i".$space."A";
-
- } elseif ( $this->options['time_clock'] == '24fr' ) {
- $time_format = "H\hi";
- } else {
- $time_format = "H:i";
- }
- if ( $this->options['time_option'] == 1 || $this->options['time_option'] == '' ) {
- $meeting_value['start_time'] = date($time_format,strtotime($meeting_value['start_time']));
- if ( $meeting_value['start_time'] == '12:00PM' || $meeting_value['start_time'] == '12:00 PM' ) {
- $meeting_value['start_time'] = 'NOON';
- }
- } elseif ( $this->options['time_option'] == '2' ) {
- $addtime = '+ ' . $minutes . ' minutes';
- $end_time = date ($time_format,strtotime($meeting_value['start_time'] . ' ' . $addtime));
- $meeting_value['start_time'] = date($time_format,strtotime($meeting_value['start_time']));
- $meeting_value['start_time'] = $meeting_value['start_time'].$space.'-'.$space.$end_time;
- } elseif ( $this->options['time_option'] == '3' ) {
- $time_array = array("1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00");
- $temp_start_time = date("g:i",strtotime($meeting_value['start_time']));
- $temp_start_time_2 = date("g:iA",strtotime($meeting_value['start_time']));
- if ( $temp_start_time_2 == '12:00PM' ) {
- $start_time = 'NOON';
- } elseif ( in_array($temp_start_time, $time_array) ) {
- $start_time = date("g",strtotime($meeting_value['start_time']));
- } else {
- $start_time = date("g:i",strtotime($meeting_value['start_time']));
- }
- $addtime = '+ ' . $minutes . ' minutes';
- $temp_end_time = date ("g:iA",strtotime($meeting_value['start_time'] . ' ' . $addtime));
- $temp_end_time_2 = date ("g:i",strtotime($meeting_value['start_time'] . ' ' . $addtime));
- if ( $temp_end_time == '12:00PM' ) {
- $end_time = 'NOON';
- } elseif ( in_array($temp_end_time_2, $time_array) ) {
- $end_time = date("g".$space."A",strtotime($temp_end_time));
- } else {
- $end_time = date("g:i".$space."A",strtotime($temp_end_time));
- }
- $meeting_value['start_time'] = $start_time.$space.'-'.$space.$end_time;
- }
+
if ( $this->options['page_fold'] !== 'full' ) {
- if ( isset($meeting_value['email_contact']) && $meeting_value['email_contact'] !== '' && $this->options['include_meeting_email'] == 1 ) {
- $str = explode("#@-@#",$meeting_value['email_contact']);
- $meeting_value['email_contact'] = $str['2'];
- } else {
- $meeting_value['email_contact'] = '';
- }
- $data = $this->options['meeting_template_content'];
- $data = str_replace(" ", " ", $data);
- $data = str_replace('borough', $meeting_value['location_city_subsection'], $data); //borough
- $data = str_replace('day_abbr', $this->getday($meeting_value['weekday_tinyint'], true, $this->lang), $data);
- $data = str_replace('weekday_tinyint_abbr', $this->getday($meeting_value['weekday_tinyint'], true, $this->lang), $data);
- $data = str_replace('day', $this->getday($meeting_value['weekday_tinyint'], false, $this->lang), $data);
- $data = str_replace('weekday_tinyint', $this->getday($meeting_value['weekday_tinyint'], false, $this->lang), $data);
- $data = str_replace('start_time', $meeting_value['start_time'], $data);
- $data = str_replace('time', $meeting_value['start_time'], $data);
-
- $meeting_value['formats'] = str_replace(',', ', ', $meeting_value['formats']);
- $data = str_replace('formats', $meeting_value['formats'], $data);
- $data = str_replace('duration_h', $duration_h, $data);
- $data = str_replace('hrs', $duration_h, $data);
- $data = str_replace('duration_m', $duration_m, $data);
- $data = str_replace('mins', $duration_m, $data);
- $data = str_replace('location_text', $meeting_value['location_text'], $data);
- $data = str_replace('location_info', $meeting_value['location_info'], $data);
- $data = str_replace('location_street', $meeting_value['location_street'], $data);
- if (isset($meeting_value['bus_line'])) {
- $data = str_replace('bus_line', $meeting_value['bus_line'], $data);
- }
- $data = str_replace('state', $meeting_value['location_province'], $data);
- $data = str_replace('street', $meeting_value['location_street'], $data);
- $data = str_replace('neighborhood', $meeting_value['location_neighborhood'], $data);
- $data = str_replace('location_municipality', $meeting_value['location_municipality'], $data);
- $data = str_replace('city', $meeting_value['location_municipality'], $data);
- $data = str_replace('location_province', $meeting_value['location_province'], $data);
- $data = str_replace('location_postal_code_1', $meeting_value['location_postal_code_1'], $data);
- $data = str_replace('zip', $meeting_value['location_postal_code_1'], $data);
- $data = str_replace('location', $meeting_value['location_text'], $data);
- $data = str_replace('info', $meeting_value['location_info'], $data);
- $data = str_replace('area_name', $area_name, $data);
- $data = str_replace('area_i', substr($area_name, 0, 1), $data);
- $data = str_replace('area', $area_name, $data);
- $data = str_replace('location_city_subsection', $meeting_value['location_city_subsection'], $data); //borough
- $data = str_replace('county', $meeting_value['location_sub_province'], $data); //county
- $data = str_replace('location_sub_province', $meeting_value['location_sub_province'], $data); //county
- $data = str_replace('meeting_name', $meeting_value['meeting_name'], $data);
- $data = str_replace('group', $meeting_value['meeting_name'], $data);
- $data = str_replace('comments', $meeting_value['comments'], $data);
- $data = str_replace('email_contact', $meeting_value['email_contact'], $data);
- $data = str_replace('email', $meeting_value['email_contact'], $data);
- $data = str_replace('
', '', $data);
- $data = str_replace(' ', '', $data);
- $data = str_replace(' ', '', $data);
- $data = str_replace('()', '', $data);
- $data = str_replace(' ', ' ', $data);
- $data = str_replace(' ', ' ', $data);
- $data = str_replace(' ', ' ', $data);
- $data = str_replace(' ', 'line_break', $data);
- $data = str_replace(' ', 'line_break', $data);
- $data = str_replace('line_break line_break', ' ', $data);
- $data = str_replace('line_breakline_break', ' ', $data);
- $data = str_replace('line_break', ' ', $data);
- $data = str_replace(' ,', ' ', $data);
- $data = str_replace(', ', ' ', $data);
- $data = str_replace(', ', ' ', $data);
- $data = str_replace(", , ,", ",", $data);
- $data = str_replace(", *,", ",", $data);
- $data = str_replace(", ,", ",", $data);
- $data = str_replace(" , ", " ", $data);
- $data = str_replace(", (", " (", $data);
- $data = str_replace(',', '', $data);
- $data = str_replace(', ', '', $data);
+ $data = $this->write_single_meeting($meeting_value, $this->options['meeting_template_content']);
} else {
$data = '';
if ( $this->options['meeting_sort'] == 'group' ) {
@@ -1355,7 +1453,19 @@ function bmlt_meeting_list($atts = null, $content = null) {
'margin_bottom' => 0,
'margin_footer' => 6,
'orientation' => 'L'
- ]);
+ ]);
+ } else if ( $this->options['page_size'] == 'A6' ) {
+ $this->mpdftmp=new mPDF([
+ 'mode' => $mode,
+ 'format' => 'A5-L',
+ 'default_font_size' => '7',
+ 'margin_left' => 0,
+ 'margin_right' => 0,
+ 'margin_top' => 0,
+ 'margin_bottom' => 0,
+ 'margin_footer' => 0,
+ 'orientation' => 'P'
+ ]);
} else {
$this->mpdftmp=new mPDF([
'mode' => $mode,
@@ -1407,7 +1517,111 @@ function bmlt_meeting_list($atts = null, $content = null) {
$this->mpdf->Output($FilePath,'I');
exit;
}
-
+ function write_single_meeting($meeting_value, $template) {
+ $duration = explode(':', $meeting_value['duration_time']);
+ $minutes = intval($duration[0])*60 + intval($duration[1]) + intval($duration[2]);
+ $meeting_value['duration_m'] = $minutes;
+ $meeting_value['duration_h'] = rtrim(rtrim(number_format($minutes/60,2),0),'.');
+ $space = ' ';
+ if ( $this->options['remove_space'] == 1 ) {
+ $space = '';
+ }
+ if ( $this->options['time_clock'] == null || $this->options['time_clock'] == '12' || $this->options['time_option'] == '' ) {
+ $time_format = "g:i".$space."A";
+
+ } elseif ( $this->options['time_clock'] == '24fr' ) {
+ $time_format = "H\hi";
+ } else {
+ $time_format = "H:i";
+ }
+ if ( $this->options['time_option'] == 1 || $this->options['time_option'] == '' ) {
+ $meeting_value['start_time'] = date($time_format,strtotime($meeting_value['start_time']));
+ if ( $meeting_value['start_time'] == '12:00PM' || $meeting_value['start_time'] == '12:00 PM' ) {
+ $meeting_value['start_time'] = 'NOON';
+ }
+ } elseif ( $this->options['time_option'] == '2' ) {
+ $addtime = '+ ' . $minutes . ' minutes';
+ $end_time = date ($time_format,strtotime($meeting_value['start_time'] . ' ' . $addtime));
+ $meeting_value['start_time'] = date($time_format,strtotime($meeting_value['start_time']));
+ if ($this->options['weekday_language']=='fa') {
+ $meeting_value['start_time'] = $this->toPersianNum($end_time).$space.'-'.$space.$this->toPersianNum($meeting_value['start_time']);
+ } else {
+ $meeting_value['start_time'] = $meeting_value['start_time'].$space.'-'.$space.$end_time;
+ }
+ } elseif ( $this->options['time_option'] == '3' ) {
+ $time_array = array("1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00");
+ $temp_start_time = date("g:i",strtotime($meeting_value['start_time']));
+ $temp_start_time_2 = date("g:iA",strtotime($meeting_value['start_time']));
+ if ( $temp_start_time_2 == '12:00PM' ) {
+ $start_time = 'NOON';
+ } elseif ( in_array($temp_start_time, $time_array) ) {
+ $start_time = date("g",strtotime($meeting_value['start_time']));
+ } else {
+ $start_time = date("g:i",strtotime($meeting_value['start_time']));
+ }
+ $addtime = '+ ' . $minutes . ' minutes';
+ $temp_end_time = date ("g:iA",strtotime($meeting_value['start_time'] . ' ' . $addtime));
+ $temp_end_time_2 = date ("g:i",strtotime($meeting_value['start_time'] . ' ' . $addtime));
+ if ( $temp_end_time == '12:00PM' ) {
+ $end_time = 'NOON';
+ } elseif ( in_array($temp_end_time_2, $time_array) ) {
+ $end_time = date("g".$space."A",strtotime($temp_end_time));
+ } else {
+ $end_time = date("g:i".$space."A",strtotime($temp_end_time));
+ }
+ $meeting_value['start_time'] = $start_time.$space.'-'.$space.$end_time;
+ }
+
+ $meeting_value['day_abbr'] = $this->getday($meeting_value['weekday_tinyint'], true, $this->options['weekday_language']);
+ $meeting_value['day'] = $this->getday($meeting_value['weekday_tinyint'], false, $this->options['weekday_language']);
+ $meeting_value['area_name'] = $area_name;
+ $meeting_value['area_i'] = substr($area_name, 0, 1);
+ //let's leave the enhancement mechanism open for now.
+ //apply_filters is one option, perhaps we will think of something better.
+ //$meeting_value = apply_filters("Bread_Enrich_Meeting_Data", $meeting_value, $this->formats_by_key);
+ $data = $template;
+ $data = str_replace(" ", " ", $data);
+ $search_strings = array();
+ $replacements = array();
+ foreach($meeting_value as $field=>$notUsed) {
+ $search_strings[] = $field;
+ $replacements[] = $this->get_field($meeting_value,$field);
+ }
+ foreach($this->legacy_synonyms as $syn=>$field) {
+ $search_strings[] = $syn;
+ $replacements[] = $this->get_field($meeting_value,$field);
+ }
+ $clean_up = array(
+ '
' => '',
+ ' ' => '',
+ ' ' => '',
+ '()' => '',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => 'line_break',
+ ' ' => 'line_break',
+ 'line_break line_break' => ' ',
+ 'line_breakline_break' => ' ',
+ 'line_break' => ' ',
+ ' ,' => ' ',
+ ', ' => ' ',
+ ', ' => ' ',
+ ", , ," => ",",
+ ", *," => ",",
+ ", ," => ",",
+ " , " => " ",
+ ", (" => " (",
+ ',' => '',
+ ', ' => '',
+ );
+ foreach($clean_up as $key=>$value) {
+ $search_strings[] = $key;
+ $replacements[] = $value;
+ }
+ $data = str_replace($search_strings,$replacements,$data);
+ return $data;
+ }
function get_booklet_pages($np, $backcover=true) {
$lastpage = $np;
$np = 4*ceil($np/4);
@@ -1429,24 +1643,12 @@ function get_booklet_pages($np, $backcover=true) {
}
function write_front_page() {
+
$this->mpdf->WriteHTML('td{font-size: '.$this->options['front_page_font_size']."pt;line-height:".$this->options['front_page_line_height'].';}',1);
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['front_page_line_height']);
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['front_page_font_size'] . 'pt');
- $this->options['front_page_content'] = str_replace('[format_codes_used_basic]', $this->write_formats($this->formats_used, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[format_codes_used_detailed]', $this->write_detailed_formats($this->formats_used, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[format_codes_used_basic_es]', $this->write_formats($this->formats_spanish, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[format_codes_used_detailed_es]', $this->write_detailed_formats($this->formats_spanish, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[format_codes_all_basic]', $this->write_formats($this->formats_all, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[format_codes_all_detailed]', $this->write_detailed_formats($this->formats_all, 'front_page'), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[meeting_count]', $this->meeting_count, $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[service_meetings]
', $this->write_service_meetings($this->options['front_page_font_size'], $this->options['front_page_line_height'] ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[service_meetings]', $this->write_service_meetings($this->options['front_page_font_size'], $this->options['front_page_line_height']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('', '', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace(' [page_break]
', ' ', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[page_break]
', ' ', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[page_break]', ' ', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('', ' ', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[date]", strtoupper( date ( "F Y" ) ), $this->options['front_page_content']);
+ $this->standard_shortcode_replacement($this->options['front_page_content'], 'front_page');
+
if ( strpos($this->options['front_page_content'], '[month_lower_fr') !== false ) {
setlocale( LC_TIME, 'fr_FR' );
$month = ucfirst(utf8_encode(strftime("%B")));
@@ -1474,47 +1676,41 @@ function write_front_page() {
setlocale(LC_TIME,NULL);
$this->options['front_page_content'] = str_replace("[month_upper_es]", $month, $this->options['front_page_content']);
}
- $this->options['front_page_content'] = str_replace("[month_lower]", date ( "F" ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[month_upper]", strtoupper( date ( "F" ) ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[month]", strtoupper( date ( "F" ) ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[day]", strtoupper( date ( "j" ) ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[year]", strtoupper( date ( "Y" ) ), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body]", strtoupper($this->options['service_body_1']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body_1]", strtoupper($this->options['service_body_1']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body_2]", strtoupper($this->options['service_body_2']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body_3]", strtoupper($this->options['service_body_3']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body_4]", strtoupper($this->options['service_body_4']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace("[service_body_5]", strtoupper($this->options['service_body_5']), $this->options['front_page_content']);
+ if ( strpos($this->options['front_page_content'], '[month_lower_de') !== false ) {
+ setlocale( LC_TIME, 'de_DE' );
+ $month = ucfirst(utf8_encode(strftime("%B")));
+ setlocale(LC_TIME,NULL);
+ $this->options['front_page_content'] = str_replace("[month_lower_de]", $month, $this->options['front_page_content']);
+ }
+
+ if ( strpos($this->options['front_page_content'], '[month_upper_de') !== false ) {
+ setlocale( LC_TIME, "de_DE.utf8" );
+ $month = utf8_encode(strftime("%B"));
+ setlocale(LC_TIME,NULL);
+ $this->options['front_page_content'] = str_replace("[month_upper_de]", $month, $this->options['front_page_content']);
+ }
+ if ( strpos($this->options['front_page_content'], '[month_lower_fa]') !== false ) {
+ setlocale( LC_TIME, 'fa_IR' );
+ $month = mb_convert_encoding (strftime("%B"), 'HTML-ENTITIES');
+ setlocale(LC_TIME,NULL);
+ $this->options['front_page_content'] = str_replace("[month_lower_fa]", $month, $this->options['front_page_content']);
+ }
$querystring_custom_items = array();
preg_match_all('/(\[querystring_custom_\d+\])/', $this->options['front_page_content'], $querystring_custom_items);
foreach ($querystring_custom_items[0] as $querystring_custom_item) {
$mod_qs_ci = str_replace("]", "", str_replace("[", "" ,$querystring_custom_item));
$this->options['front_page_content'] = str_replace($querystring_custom_item, (isset($_GET[$mod_qs_ci]) ? $_GET[$mod_qs_ci] : "NOT SET"), $this->options['front_page_content']);
}
- $this->options['front_page_content'] = str_replace("[area]", strtoupper($this->options['service_body_1']), $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[page_break no_page_number]', ' ', $this->options['front_page_content']);
- $this->options['front_page_content'] = str_replace('[start_page_numbers]', ' ', $this->options['front_page_content']);
$this->options['front_page_content'] = mb_convert_encoding($this->options['front_page_content'], 'HTML-ENTITIES');
$this->mpdf->WriteHTML(utf8_encode(wpautop(stripslashes($this->options['front_page_content']))));
-
+ $this->mpdf->showWatermarkImage = false;
}
function write_last_page() {
$this->mpdf->WriteHTML('td{font-size: '.$this->options['last_page_font_size']."pt;line-height:".$this->options['last_page_line_height'].';}',1);
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['last_page_font_size'] . 'pt');
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['last_page_line_height']);
- $this->options['last_page_content'] = str_replace('[format_codes_used_basic]', $this->write_formats($this->formats_used, 'last_page'), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[format_codes_used_detailed]', $this->write_detailed_formats($this->formats_used, 'last_page'), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[format_codes_all_basic]', $this->write_formats($this->formats_all, 'last_page'), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[format_codes_all_detailed]', $this->write_detailed_formats($this->formats_all, 'last_page'), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[meeting_count]', $this->meeting_count, $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[service_meetings]
', $this->write_service_meetings($this->options['last_page_font_size'], $this->options['last_page_line_height']), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[service_meetings]', $this->write_service_meetings($this->options['last_page_font_size'], $this->options['last_page_line_height']), $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('', '', $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace(' [page_break]
', ' ', $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[page_break]
', ' ', $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('[page_break]', ' ', $this->options['last_page_content']);
- $this->options['last_page_content'] = str_replace('', ' ', $this->options['last_page_content']);
+ $this->standard_shortcode_replacement($this->options['last_page_content'], 'last_page');
$this->options['last_page_content'] = mb_convert_encoding($this->options['last_page_content'], 'HTML-ENTITIES');
$this->mpdf->WriteHTML(utf8_encode(wpautop(stripslashes($this->options['last_page_content']))));
}
@@ -1522,23 +1718,45 @@ function write_last_page() {
function write_custom_section() {
$this->mpdf->SetDefaultBodyCSS('line-height', $this->options['custom_section_line_height']);
$this->mpdf->SetDefaultBodyCSS('font-size', $this->options['custom_section_font_size'] . 'pt');
- $this->options['custom_section_content'] = str_replace('[format_codes_used_basic_es]', $this->write_formats($this->formats_spanish, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[format_codes_used_detailed_es]', $this->write_detailed_formats($this->formats_spanish, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[format_codes_used_basic]', $this->write_formats($this->formats_used, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[format_codes_used_detailed]', $this->write_detailed_formats($this->formats_used, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[format_codes_all_basic]', $this->write_formats($this->formats_all, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[format_codes_all_detailed]', $this->write_detailed_formats($this->formats_all, 'custom_section'), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[meeting_count]', $this->meeting_count, $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[service_meetings]
', $this->write_service_meetings($this->options['custom_section_font_size'], $this->options['last_page_line_height']), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[service_meetings]', $this->write_service_meetings($this->options['custom_section_font_size'], $this->options['last_page_line_height']), $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[new_column]
', ' ', $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('[new_column]', ' ', $this->options['custom_section_content']);
- $this->options['custom_section_content'] = str_replace('', '', $this->options['custom_section_content']);
+ $this->standard_shortcode_replacement($this->options['custom_section_content'], '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->options['custom_section_content'] = mb_convert_encoding($this->options['custom_section_content'], 'HTML-ENTITIES');
$this->mpdf->WriteHTML(utf8_encode(wpautop(stripslashes($this->options['custom_section_content']))));
}
+ function standard_shortcode_replacement(&$data, $page) {
+ $search_strings = array();
+ $replacements = array();
+ foreach($this->section_shortcodes as $key=>$value) {
+ $search_strings[] = $key;
+ $replacements[] = $value;
+ }
+ $data = str_replace($search_strings,$replacements,$data);
+ $this->replace_format_shortcodes($data, $page);
+ $data = str_replace("[date]", strtoupper( date ( "F Y" ) ), $data);
+ $data = str_replace(' [service_meetings]
', $this->write_service_meetings($this->options[$page.'_font_size'], $this->options[$page.'_line_height'] ), $data);
+ $data = str_replace('[service_meetings]', $this->write_service_meetings($this->options[$page.'_font_size'], $this->options[$page.'_line_height']), $data);
+ }
+ function replace_format_shortcodes(&$data, $page_name) {
+
+ $this->shortcode_formats('[format_codes_used_basic]',false,$this->formats_used, $page_name, $data);
+ $this->shortcode_formats('[format_codes_used_detailed]', true, $this->formats_used, $page_name, $data);
+ $this->shortcode_formats('[format_codes_used_basic_es]', false, $this->formats_spanish, $page_name, $data);
+ $this->shortcode_formats('[format_codes_used_detailed_es]', true, $this->formats_spanish, $page_name, $data);
+ $this->shortcode_formats('[format_codes_all_basic]', false, $this->formats_all, $page_name, $data);
+ $this->shortcode_formats('[format_codes_all_detailed]', true, $this->formats_all, $page_name, $data);
+ }
+ function shortcode_formats($shortcode,$detailed,$formats,$page,&$str) {
+ $pos = strpos($str,$shortcode);
+ if ($pos==FALSE) return;
+ $value = '';
+ if ($detailed) {
+ $value = $this->write_detailed_formats($formats,$page);
+ } else {
+ $value = $this->write_formats($formats,$page);
+ }
+ $str = substr($str,0,$pos).$value.substr($str,$pos+strlen($shortcode));
+ }
function write_formats($formats, $page) {
if ( $formats == null ) { return ''; }
$this->mpdf->WriteHTML('td{font-size: '.$this->options[$page.'_font_size']."pt;line-height:".$this->options[$page.'_line_height'].';}',1);
@@ -1569,7 +1787,22 @@ function write_detailed_formats($formats, $page) {
$data .= "";
return $data;
}
-
+ private function parse_field($text) {
+ if ($text!='') {
+ $exploded = explode("#@-@#", $text);
+ if (count($exploded) > 1) {
+ $text = $exploded[1];
+ }
+ }
+ return $text;
+ }
+ function get_field($obj,$field) {
+ $value = '';
+ if (isset($obj[$field])) {
+ $value = $this->parse_field($obj[$field]);
+ }
+ return $value;
+ }
function write_service_meetings($font_size, $line_height) {
if ( $this->service_meeting_result == null ) {
return '';
@@ -1578,7 +1811,7 @@ function write_service_meetings($font_size, $line_height) {
$x = 0;
foreach ($this->service_meeting_result as $value) {
$enFormats = explode ( ",", $value['formats'] );
- if ( ! in_array ( "ASM", $enFormats ) ) {
+ if ( ! in_array ( $this->options['asm_format_key'], $enFormats ) ) {
continue;
}
$x++;
@@ -1586,10 +1819,19 @@ function write_service_meetings($font_size, $line_height) {
if ( $x == 0 ) {
return $data;
}
- $data .= "";
+ $template = '';
+ if (isset($this->options['asm_template_content']) && trim($this->options['asm_template_content'])) {
+ $template = $this->options['asm_template_content'];
+ } else {
+ $data .= "";
+ }
foreach ($this->service_meeting_result as $value) {
$enFormats = explode ( ",", $value['formats'] );
- if ( ! in_array ( "ASM", $enFormats ) ) {
+ if ( ! in_array ( $this->options['asm_format_key'], $enFormats ) ) {
+ continue;
+ }
+ if ($template != '') {
+ $data .= $this->write_single_meeting($value, $template);
continue;
}
$display_string = ''.$value['meeting_name'].' ';
@@ -1632,7 +1874,8 @@ function write_service_meetings($font_size, $line_height) {
$display_string .= $value['email_contact'];
$data .= "".$display_string." ";
}
- $data .= "
";
+ if ($template == '')
+ $data .= "
";
return $data;
}
@@ -1641,7 +1884,8 @@ function write_service_meetings($font_size, $line_height) {
*/
function admin_menu_link() {
global $my_admin_page;
- $my_admin_page = add_menu_page( 'Meeting List', 'Meeting List', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page'), 'dashicons-admin-page');
+ Bread::add_cap();
+ $my_admin_page = add_menu_page( 'Meeting List', 'Meeting List', 'manage_bread', basename(__FILE__), array(&$this, 'admin_options_page'), 'dashicons-admin-page');
}
function bmltrootserverurl_meta_box() {
@@ -1665,25 +1909,28 @@ function admin_options_page() {
@@ -1694,6 +1941,9 @@ function admin_options_page() {
if ($_POST['bmltmeetinglistsave']) {
if (!wp_verify_nonce($_POST['_wpnonce'], 'bmltmeetinglistupdate-options'))
die('Whoops! There was a problem with the data you posted. Please go back and try again.');
+ if (!$this->current_user_can_modify()) {
+ return;
+ }
$this->options['front_page_content'] = wp_kses_post($_POST['front_page_content']);
$this->options['last_page_content'] = wp_kses_post($_POST['last_page_content']);
$this->options['front_page_line_height'] = $_POST['front_page_line_height'];
@@ -1713,6 +1963,10 @@ function admin_options_page() {
$this->options['margin_left'] = intval($_POST['margin_left']);
$this->options['margin_bottom'] = intval($_POST['margin_bottom']);
$this->options['margin_top'] = intval($_POST['margin_top']);
+ $this->options['margin_header'] = intval($_POST['margin_header']);
+ $this->options['pageheader_fontsize'] = intval($_POST['pageheader_fontsize']);
+ $this->options['pageheader_text'] = sanitize_text_field($_POST['pageheader_text']);
+ $this->options['watermark'] = sanitize_text_field($_POST['watermark']);
$this->options['page_size'] = sanitize_text_field($_POST['page_size']);
$this->options['page_orientation'] = validate_page_orientation($_POST['page_orientation']);
$this->options['page_fold'] = sanitize_text_field($_POST['page_fold']);
@@ -1722,6 +1976,7 @@ function admin_options_page() {
$this->options['neighborhood_suffix'] = sanitize_text_field($_POST['neighborhood_suffix']);
$this->options['city_suffix'] = sanitize_text_field($_POST['city_suffix']);
$this->options['meeting_template_content'] = wp_kses_post($_POST['meeting_template_content']);
+ $this->options['asm_template_content'] = wp_kses_post($_POST['asm_template_content']);
$this->options['column_line'] = boolval($_POST['column_line']); #seperator
$this->options['col_color'] = validate_hex_color($_POST['col_color']);
$this->options['custom_section_content'] = wp_kses_post($_POST['custom_section_content']);
@@ -1736,6 +1991,9 @@ function admin_options_page() {
$this->options['weekday_language'] = sanitize_text_field($_POST['weekday_language']);
$this->options['weekday_start'] = sanitize_text_field($_POST['weekday_start']);
$this->options['include_asm'] = boolval($_POST['include_asm']);
+ $this->options['asm_format_key'] = sanitize_text_field($_POST['asm_format_key']);
+ $this->options['asm_sort_order'] = sanitize_text_field($_POST['asm_sort_order']);
+ $this->options['asm_logged_in'] = isset($_POST['asm_logged_in']) ? boolval($_POST['asm_logged_in']) : false;
$this->options['bmlt_login_id'] = sanitize_text_field($_POST['bmlt_login_id']);
$this->options['bmlt_login_password'] = sanitize_text_field($_POST['bmlt_login_password']);
$this->options['base_font'] = sanitize_text_field($_POST['base_font']);
@@ -1753,6 +2011,15 @@ function admin_options_page() {
$this->options['cache_time'] = intval($_POST['cache_time']);
$this->options['custom_query'] = sanitize_text_field($_POST['custom_query']);
$this->options['extra_meetings'] = isset($_POST['extra_meetings']) ? wp_kses_post($_POST['extra_meetings']) : '';
+ $authors = $_POST['authors_select'];
+ $this->options['authors'] = array();
+ foreach ($authors as $author) {
+ $this->options['authors'][] = intval($author);
+ }
+ $user = wp_get_current_user();
+ if (!in_array($user->ID, $this->options['authors'])) {
+ $this->options['authors'][] = $user->ID;
+ }
$this->save_admin_options();
set_transient( 'admin_notice', 'Please put down your weapon. You have 20 seconds to comply.' );
echo 'Your changes were successfully saved!
';
@@ -1855,6 +2122,9 @@ function admin_options_page() {
if ( !isset($this->options['meeting_template_content']) || strlen(trim($this->options['meeting_template_content'])) == 0 ) {
$this->options['meeting_template_content'] = '';
}
+ if ( !isset($this->options['asm_template_content']) || strlen(trim($this->options['asm_template_content'])) == 0 ) {
+ $this->options['asm_template_content'] = '';
+ }
if ( !isset($this->options['column_line']) || strlen(trim($this->options['column_line'])) == 0 ) {
$this->options['column_line'] = 0;
}
@@ -1902,7 +2172,13 @@ function admin_options_page() {
}
if ( !isset($this->options['include_asm']) || strlen(trim($this->options['include_asm'])) == 0 ) {
$this->options['include_asm'] = '0';
- }
+ }
+ if ( !isset($this->options['asm_format_key']) || strlen(trim($this->options['asm_format_key'])) == 0 ) {
+ $this->options['asm_format_key'] = 'ASM';
+ }
+ if ( !isset($this->options['asm_sort_order']) || strlen(trim($this->options['asm_sort_order'])) == 0 ) {
+ $this->options['asm_sort_order'] = 'name';
+ }
if ( !isset($this->options['bmlt_login_id']) || strlen(trim($this->options['bmlt_login_id'])) == 0 ) {
$this->options['bmlt_login_id'] = '';
}
@@ -1918,16 +2194,26 @@ function admin_options_page() {
if ( !isset($this->options['cache_time']) || strlen(trim($this->options['cache_time'])) == 0 ) {
$this->options['cache_time'] = 0;
}
- if ( !isset($this->options['extra_meetings']) || $this->options['extra_meetings'] == '' ) {
+ if ( !isset($this->options['extra_meetings']) || count($this->options['extra_meetings']) == 0 || $this->options['extra_meetings'] == '') {
$this->options['extra_meetings'] = '';
} else {
$this->options['extra_meetings_enabled'] = 1;
}
+ if ( !isset($this->options['asm_logged_in']) ) {
+ if (strlen ($this->options['bmlt_login_password']) > 0 && strlen ($this->options['bmlt_login_password']) > 0) {
+ $this->options['asm_logged_in'] = wp_remote_retrieve_body($this->authenticate_root_server());
+ } else {
+ $this->options['asm_logged_in'] = false;
+ }
+ }
+ $this->authors_safe = $this->options['authors'];
?>
-
bread
+
+
+
@@ -1937,9 +2223,10 @@ function admin_options_page() {
-
+
current_user_can_modify() ) {
+ return;
+ }
+ if ($this->loaded_setting == 1) {
+ return;
+ }
+ unset($this->allSettings[$this->loaded_setting]);
+ if ($this->loaded_setting == $this->max_setting) {
+ foreach ($this->allSettings as $aKey=>$aDescr) {
+ $this->max_setting = $aKey;
+ }
+ }
+ update_option(Bread::SETTINGS,$this->allSettings);
+ $this->getMLOptions(1);
+ $this->loaded_setting = 1;
+ } elseif (isset($_POST['duplicate'])) {
+ if (!$this->current_user_can_create()) {
+ return;
+ }
+ $id = $this->maxSetting + 1;
+ $this->optionsName = $this->generateOptionName($id);
+ $this->authors_safe = array();
+ $this->options['authors'] = array();
+ $this->save_admin_options();
+ $this->allSettings[$id] = 'Setting '.$id;
+ update_option(Bread::SETTINGS,$this->allSettings);
+ $this->maxSetting = $id;
+ $this->getMLOptions($id);
+ }
+ }
+ function pwsix_process_rename_settings() {
+ if ( isset($_POST['bmltmeetinglistsave']) && $_POST['bmltmeetinglistsave'] == 'Save Changes' )
+ return;
+ if( empty( $_POST['pwsix_action'] ) || 'rename_setting' != $_POST['pwsix_action'] )
+ return;
+ if( ! wp_verify_nonce( $_POST['pwsix_rename_nonce'], 'pwsix_rename_nonce' ) )
+ return;
+ if( ! $this->current_user_can_modify() )
+ return;
+
+ $this->allSettings[$this->loaded_setting] = sanitize_text_field($_POST['setting_descr']);
+ update_option(Bread::SETTINGS,$this->allSettings);
+ }
/**
* Process a settings export that generates a .json file of the shop settings
*/
@@ -2029,7 +2380,7 @@ function pwsix_process_settings_export() {
return;
if( ! wp_verify_nonce( $_POST['pwsix_export_nonce'], 'pwsix_export_nonce' ) )
return;
- if( ! current_user_can( 'manage_options' ) )
+ if( ! current_user_can( 'manage_bread' ) ) // TODO: Is this necessary? Why not let the user make a copy
return;
$blogname = str_replace(" - ", " ", get_option('blogname'));
@@ -2051,7 +2402,28 @@ function pwsix_process_settings_export() {
echo json_encode( $settings );
exit;
}
-
+ function current_user_can_modify() {
+ if( ! current_user_can( 'manage_bread' ) ) {
+ return false;
+ }
+ $user = wp_get_current_user();
+ if (in_array('administrator', $user->roles)) {
+ return true;
+ }
+ if (!is_array($this->authors_safe) || empty($this->authors_safe)) {
+ return true;
+ }
+ if (in_array($user->ID, $this->authors_safe)) {
+ return true;
+ }
+ return false;
+ }
+ function current_user_can_create() {
+ if( ! current_user_can( 'manage_bread' ) ) {
+ return false;
+ }
+ return true;
+ }
/**
* Process a settings import from a json file
*/
@@ -2062,7 +2434,7 @@ function pwsix_process_settings_import() {
return;
if( empty( $_REQUEST['pwsix_import_nonce']) || !wp_verify_nonce( $_REQUEST['pwsix_import_nonce'], 'pwsix_import_nonce' ) )
return;
- if( ! current_user_can( 'manage_options' ) )
+ if( ! current_user_can( 'manage_bread' ) )
return;
$file_name = $_FILES['import_file']['name'];
$tmp = explode( '.', $file_name);
@@ -2079,16 +2451,19 @@ function pwsix_process_settings_import() {
wp_die( __( 'File size greater than 500k' ) );
}
$encode_options = file_get_contents($import_file);
- $settings = json_decode($encode_options, true);
+ $settings = json_decode($encode_options, true);
+ $settings['authors'] = $this->authors_safe;
update_option( $this->optionsName, $settings );
- wp_safe_redirect( admin_url( '?page=bmlt-meeting-list.php&pwsix_action=import_settings' ) );
+ setcookie('pwsix_action', "import_settings", time()+10);
+ setcookie('current-meeting-list', $this->loaded_setting, time()+10);
+ wp_safe_redirect( admin_url( '?page=bmlt-meeting-list.php' ) );
}
/**
* Process a default settings
*/
function pwsix_process_default_settings() {
- if ( ! current_user_can( 'manage_options' ) ||
+ if ( ! current_user_can( 'manage_bread' ) ||
(isset($_POST['bmltmeetinglistsave']) && $_POST['bmltmeetinglistsave'] == 'Save Changes' )) {
return;
} elseif ( isset($_REQUEST['pwsix_action']) && 'three_column_default_settings' == $_REQUEST['pwsix_action'] ) {
@@ -2109,9 +2484,12 @@ function pwsix_process_default_settings() {
if( empty( $import_file ) )
wp_die( __( 'Error importing default settings file' ) );
$encode_options = file_get_contents($import_file);
- $settings = json_decode($encode_options, true);
+ $settings = json_decode($encode_options, true);
+ $settings['authors'] = $this->authors_safe;
update_option( $this->optionsName, $settings );
- wp_safe_redirect( admin_url( '?page=bmlt-meeting-list.php&pwsix_action=default_settings_success' ) );
+ setcookie('pwsix_action', "default_settings_success", time()+10);
+ setcookie('current-meeting-list', $this->loaded_setting, time()+10);
+ wp_safe_redirect( admin_url( '?page=bmlt-meeting-list.php' ) );
}
/**
@@ -2127,15 +2505,35 @@ function filter_plugin_actions($links, $file) {
* Retrieves the plugin options from the database.
* @return array
*/
- function getMLOptions() {
+ function getMLOptions($current_setting) {
+ if ($current_setting < 1 and is_admin( )) {
+ $current_setting = 1;
+ }
+ if ($current_setting != 1) {
+ $this->optionsName = $this->generateOptionName($current_setting);
+ } else {
+ $this->optionsName = Bread::OPTIONS_NAME;
+ }
//Don't forget to set up the default options
if (!$theOptions = get_option($this->optionsName)) {
+ if ($current_setting != 1) {
+ unset($this->allSettings[$current_setting]);
+ update_option(Bread::SETTINGS, $this->allSettings);
+ die('Undefined setting: '. $current_setting);
+ }
$import_file = plugin_dir_path(__FILE__) . "includes/three_column_settings.json";
$encode_options = file_get_contents($import_file);
$theOptions = json_decode($encode_options, true);
update_option( $this->optionsName, $theOptions );
}
$this->options = $theOptions;
+ $this->authors_safe = $theOptions['authors'];
+ $this->loaded_setting = $current_setting;
+ }
+
+ private function generateOptionName($current_setting)
+ {
+ return Bread::OPTIONS_NAME . '_' . $current_setting;
}
/**
@@ -2175,4 +2573,3 @@ public function getLatestRootVersion() {
if (class_exists("Bread")) {
$BMLTMeetinglist_instance = new Bread();
}
-?>
diff --git a/css/admin.css b/css/admin.css
index 1b4b2e0..d5a58a0 100644
--- a/css/admin.css
+++ b/css/admin.css
@@ -1,3 +1,39 @@
+.wpbody-content {
+ margin-top: 0;
+ margin-left: 0;
+ margin-right: 0;
+ height: 100%;
+ width: 100%;
+}
+
+#tallyBannerContainer {
+ background-image: url('images/banner_rails.png');
+ background-repeat: repeat-x;
+ background-size: 15% 100%;
+ display: block;
+ height: 15%;
+ width: auto;
+}
+
+img#tallyBannerImage {
+ display: block;
+ margin: auto;
+ height: 100%;
+ width: auto;
+}
+
+/* Portrait */
+@media only screen
+and (min-device-width: 320px)
+and (max-device-width: 480px)
+and (-webkit-min-device-pixel-ratio: 2)
+and (orientation: portrait) {
+ #tallyBannerContainer {
+ background-size: 12% 100%;
+ height: 12%;
+ }
+}
+
.ui-accordion .ui-accordion-icons {
padding-left: 2.2em !important;
}
@@ -82,7 +118,7 @@ div#meeting-list-tabs-wrapper li {
#meeting-list-tabs h3 {
font-size: 16px;
font-weight: 500;
- color: #9E2121;
+ color: #0A61AD;
}
#meeting-list-tabs .icon-forward {
margin-top: 1px;
@@ -225,7 +261,7 @@ background: rgba(0, 0, 0, 0);
color: #222 !important;
}
#meeting-list-tabs input[class=mlg]:checked+label {
- color: #863B3B !important;
+ color: #0A61AD !important;
font-weight: bold !important;
}
/* #meeting-list-tabs input:checked + span > label {
@@ -250,7 +286,7 @@ color: #999;
color: #000;
}
input:checked ~ td > label {
- color: #863B3B !important;
+ color: #0A61AD !important;
font-weight: bold !important;
}
#meeting-list-tabs h2 {
@@ -272,7 +308,7 @@ font-size: 22px;
}
.tooltipster-default
{
- background: #4c4c4c;
+ background: #888888;
border: 2px solid #111;
border-radius: 5px;
color: #fff;
@@ -291,7 +327,7 @@ font-size: 22px;
.tooltipster-icon {
cursor: help;
margin-left: 10px;
- background: url("images/help-image.png") no-repeat;
+ background: url("images/help-image2.png") no-repeat;
color: rgba(0, 0, 0, 0);
padding-right: 5px;
}
@@ -607,15 +643,14 @@ color: #222;
}
#meeting-list-tabs.ui-tabs.ui-tabs-vertical .ui-tabs-nav li a:hover {
cursor: pointer;
- background-color: #7AD03A;
+ background-color: #0A8ADD;
color: #555;
}
#meeting-list-tabs.ui-tabs.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active {
margin-bottom: 0.2em;
padding-bottom: 0;
border-right: 1px solid #FFF;
-background: #7AD03A;
-background-color: #7AD03A;
+background-color: #0A8ADD;
}
#meeting-list-tabs.ui-tabs.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active a {
color: #000;
@@ -636,15 +671,13 @@ padding: 6px 3px !important;
}
#meeting-list-tabs.ui-state-default, #meeting-list-tabs.ui-widget-content .ui-state-default, #meeting-list-tabs.ui-widget-header .ui-state-default {
border: 1px solid #E5E5E5;
-background: #495b4a;
-background-color: #495b4a;
+background: #0A61AD;
font-weight: normal;
color: #FFF;
}
#meeting-list-tabs .ui-accordion .ui-accordion-content {
border: 1px solid #E5E5E5 !important;
background-color: #FFF !important;
- background: #FFF !important;
border-bottom-width: 0;
}
#meeting-list-tabs hr {
@@ -698,7 +731,7 @@ width: 4em !important;
color: #FFF !important;
}
h3.help-accordian { background-color: #F5F5F5 !important; color: #000 !important; font-weight: 400 !important; border: 1px solid #E5E5E5 !important;}
-.help-accordian .ui-icon { background-color: #B80000; }
+.help-accordian .ui-icon { background-color: #0A8ADD; }
.videocontent {
width:100%;
max-width: 100%;
diff --git a/css/images/banner.png b/css/images/banner.png
new file mode 100644
index 0000000..ff3fefd
Binary files /dev/null and b/css/images/banner.png differ
diff --git a/css/images/banner_rails.png b/css/images/banner_rails.png
new file mode 100644
index 0000000..786e8a7
Binary files /dev/null and b/css/images/banner_rails.png differ
diff --git a/css/images/help-image.png b/css/images/help-image.png
deleted file mode 100644
index c07aced..0000000
Binary files a/css/images/help-image.png and /dev/null differ
diff --git a/css/images/help-image2.png b/css/images/help-image2.png
new file mode 100644
index 0000000..a262e48
Binary files /dev/null and b/css/images/help-image2.png differ
diff --git a/js/bmlt_meeting_list.js b/js/bmlt_meeting_list.js
index 2618d9c..0dab745 100644
--- a/js/bmlt_meeting_list.js
+++ b/js/bmlt_meeting_list.js
@@ -363,10 +363,8 @@ var $ml = jQuery.noConflict
$ml("#container").removeClass('hide');
var meeting_sort_val = $ml("#meeting_sort").val();
if (meeting_sort_val === 'day' || meeting_sort_val === 'weekday_area' || meeting_sort_val === 'weekday_city' || meeting_sort_val === 'weekday_county') {
- $ml('.weekday_language_div').show();
$ml('.weekday_start_div').show();
} else {
- $ml('.weekday_language_div').hide();
$ml('.weekday_start_div').hide();
}
$ml('.borough_by_suffix').hide();
@@ -392,10 +390,8 @@ var $ml = jQuery.noConflict
$ml('.neighborhood_by_suffix').hide();
$ml('.city_by_suffix').hide();
if (meeting_sort_val === 'day' || meeting_sort_val === 'weekday_area' || meeting_sort_val === 'weekday_city' || meeting_sort_val === 'weekday_county') {
- $ml('.weekday_language_div').show()
$ml('.weekday_start_div').show();
} else {
- $ml('.weekday_language_div').hide();
$ml('.weekday_start_div').hide();
}
if (meeting_sort_val === 'borough_county') {
@@ -517,6 +513,7 @@ var $ml = jQuery.noConflict
$ml('#pagenodiv').hide();
$ml("#5inch, label[for=5inch]").hide();
$ml("#A5, label[for=A5]").hide();
+ $ml("#A6, label[for=A6]").hide();
$ml("#meeting-list-tabs ul li:eq(5)").hide();
$ml("#meeting-list-tabs ul li:eq(6)").show();
$ml('#meeting-list-tabs').tabs('disable', 5);
@@ -528,6 +525,7 @@ var $ml = jQuery.noConflict
} else {
$ml("#5inch, label[for=5inch]").hide();
$ml("#A5, label[for=A5]").hide();
+ $ml("#A6, label[for=A6]").hide();
$ml('#meeting-list-tabs').tabs('disable', 6);
$ml("#meeting-list-tabs ul li:eq(6)").hide();
}
@@ -545,6 +543,7 @@ var $ml = jQuery.noConflict
$ml('input[name=page_orientation]').val(['L']);
$ml("#5inch, label[for=5inch]").show();
$ml("#A5, label[for=A5]").show();
+ $ml("#A6, label[for=A6]").show();
$ml("#letter, label[for=letter]").hide();
$ml("#legal, label[for=legal]").hide();
$ml("#ledger, label[for=ledger]").hide();
@@ -596,6 +595,7 @@ var $ml = jQuery.noConflict
$ml('input[name=page_orientation]').val(['L']);
$ml("#5inch, label[for=5inch]").hide();
$ml("#A5, label[for=A5]").hide();
+ $ml("#A6, label[for=A6]").hide();
$ml("#letter, label[for=letter]").show();
$ml("#legal, label[for=legal]").show();
$ml("#ledger, label[for=ledger]").show();
@@ -699,6 +699,18 @@ var $ml = jQuery.noConflict
$ml('#extra_meetings').on('chosen:hiding_dropdown', function(evt, params) {
$ml(".ctrl_key").hide();
});
+ $ml("#author_chosen").chosen({
+ no_results_text: "Oops, nothing found!",
+ width: "100%",
+ placeholder_text_multiple: "Select authors",
+ search_contains: true
+ });
+ $ml('#author_chosen').on('chosen:showing_dropdown', function(evt, params) {
+ $ml(".ctrl_key").show();
+ });
+ $ml('#author_chosen').on('chosen:hiding_dropdown', function(evt, params) {
+ $ml(".ctrl_key").hide();
+ });
/*
$ml("#extra_meetings").select2({
//tags: "true",
diff --git a/partials/_backup_restore_setup.php b/partials/_backup_restore_setup.php
index 836d345..3eb12a7 100644
--- a/partials/_backup_restore_setup.php
+++ b/partials/_backup_restore_setup.php
@@ -6,13 +6,53 @@
+
diff --git a/partials/_bmlt_server_setup.php b/partials/_bmlt_server_setup.php
index eb77c55..f88746c 100644
--- a/partials/_bmlt_server_setup.php
+++ b/partials/_bmlt_server_setup.php
@@ -1,7 +1,18 @@
+}
+$all_users = get_users();
+$specific_users = array();
+
+foreach($all_users as $user){
+
+ if($user->has_cap('manage_bread')){
+ $specific_users[] = $user;
+ }
+
+}
+?>
@@ -193,7 +204,17 @@
Current Meeting List Link
+
+
+
Meeting List Author(s)
+
+
+
+ ID, $this->authors_safe) ? 'selected=' :'' ?>>user_firstname ?> user_lastname ?> (user_login ?>)
+
+
@@ -213,8 +234,10 @@
+ current_user_can_modify()) echo '
-
Generate Meeting List '; ?>
+ ';?>
+
Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/partials/_custom_section_setup.php b/partials/_custom_section_setup.php
index 977d7b2..cf8fc19 100644
--- a/partials/_custom_section_setup.php
+++ b/partials/_custom_section_setup.php
@@ -41,7 +41,9 @@
-
- Generate Meeting List '; ?>
+ current_user_can_modify()) echo '
+
+ ';?>
+ Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/partials/_front_page_setup.php b/partials/_front_page_setup.php
index c5068f9..981a396 100644
--- a/partials/_front_page_setup.php
+++ b/partials/_front_page_setup.php
@@ -40,8 +40,10 @@
-
- Generate Meeting List '; ?>
+ current_user_can_modify()) echo '
+
+ ';?>
+ Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/partials/_last_page_setup.php b/partials/_last_page_setup.php
index 0f4290c..df8b52d 100644
--- a/partials/_last_page_setup.php
+++ b/partials/_last_page_setup.php
@@ -38,8 +38,10 @@
-
- Generate Meeting List '; ?>
+ current_user_can_modify()) echo '
+
+ ';?>
+ Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/partials/_layout_setup.php b/partials/_layout_setup.php
index 5cbffcc..d497ef6 100644
--- a/partials/_layout_setup.php
+++ b/partials/_layout_setup.php
@@ -64,6 +64,7 @@
options['page_size'] == '5inch' ? 'checked' : '') ?>>Booklet (11" X 8.5")
options['page_size'] == 'A5' ? 'checked' : '') ?>>Booklet-A5 (297mm X 210mm)
+ options['page_size'] == 'A6' ? 'checked' : '') ?>>Booklet-A6 (210mm X 142mm)
options['page_size'] == 'letter' ? 'checked' : '') ?>>Letter (8.5" X 11")
options['page_size'] == 'legal' ? 'checked' : '') ?>>Legal (8.5" X 14")
options['page_size'] == 'ledger' ? 'checked' : '') ?>>Ledger (17" X 11")
@@ -78,6 +79,14 @@
Right:
+
+
+ Header Margin Top:
+ Header Fontsize:
+ Header Text:
+ Watermark:
+
+
-
- Generate Meeting List '; ?>
+ current_user_can_modify()) echo '
+
+ ';?>
+ Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/partials/_meeting_list_setup.php b/partials/_meeting_list_setup.php
index 9c4be7f..38dbd5d 100644
--- a/partials/_meeting_list_setup.php
+++ b/partials/_meeting_list_setup.php
@@ -29,7 +29,7 @@
Default Settings and Content
Changing the Default Settings and Content should only be considered when first using the Meeting List Generator or when you decide to completely start over with setting up your meeting list.
The buttons below will completely reset your meeting list settings (and content) to whichever layout you choose. There is no Undo.
- Consider backing up settings by using the Backup/Restore Tab before changing your Meeting List Settings.
+ Consider backing up settings by using the Configuration Tab before changing your Meeting List Settings.
@@ -44,22 +44,12 @@
Multiple Meeting Lists
-
Currently, this tool supports one meeting list per site.
-
The following methods could be used to get additional meeting lists.
-
Method 1. Install additional Wordpress installations on your server. For example:
-
- Add a sub-domain for each meeting list. For example:
-
- area1.region.org
- area2.region.org
- area3.region.org
-
- Install Wordpress on each sub-domain.
- Install the bread plugin on each sub-domain.
- Provide the login to each Wordpress installation to each local web-servant.
-
-
Method 2. Create a Wordpress multi-site installation.
-
Method 3. Contribute to this project so that multiple meeting lists could be configured in this plugin.
+
This tool supports multiple meeting lists per site.
+
This feature is configured from the Configuration Tab. There, each concurrent meeting list can be given a
+ name, and the system gives the meeting list a numberic identifier. The meeting list can then be generated using
+ a link of the form http://[host]?current-meeting-list=[id]
+
After switching to another concurrent meeting list, any changes in the admin UI impact the currently selected meeting list
+
If you want to give another user access to bread you can give that use the "manage_bread" capability using a custom role editor.
Reusable Templating
diff --git a/partials/_meetings_setup.php b/partials/_meetings_setup.php
index 86256a8..dbd6717 100644
--- a/partials/_meetings_setup.php
+++ b/partials/_meetings_setup.php
@@ -105,7 +105,9 @@
"both_po" => "English/Spanish/Portuguese",
"fr_en" => "French/English",
"se" => "Swedish",
- "dk" => "Danish"
+ "dk" => "Danish",
+ "de" => "German",
+ "farsi" => "Farsi"
];
?>
@@ -298,19 +300,49 @@
authenticate_root_server()); ?>
+
Login ID or Password Incorrect "; ?>
Login OK "; ?>
-
Special Features
+
Additional List
+ This section allows the definition of an additional meeting list, containing meetings that should not be included in the main
+ list. This is typically service meetings, but it can be any group of meetings identified by a format.
+
+ Format of meetings in the additional list:
+
+
+ Not Used
+
+
+ options['asm_format_key'] ) { ?>
+
+
+
+
+
+
+
+
+
+
+ Select sort order for the additional list
+
+ By Name
+ By Day and Time
+
+
+ The additional list may include fields that might be used for say "service meetings". To access these fields
+ you must login with an service body administrator account.
+
Login ID:
Password:
-
+
-
-
- Show
Area Service Meetings (ASM) in the meeting list.
-
In BMLT a meeting can have the format code ASM indicating it is a service meeting.
-
Typically Areas show their Area Service Meetings separately on the meeting list
-
and may not want to show the Area Service Meetings again in the list of regular meetings.
-
To list the Area Service Meetings in the list of regular meetings enable this check-box.
-
If you login, you can use unpublished meetings with the ASM format.
- ';
- ?>
-
Show Area Service Meetings
-
-
options['include_asm'] == '1' ? 'checked' : '') ?>>Enable
+
+
+
options['include_asm'] == '1' ? 'checked' : '') ?>>Include meetings with this format in the main list
+ The default format for the additional list is ASM. If you wish to define a different format for the additional list, use this template.
+
+ FALSE,
+ 'editor_height' => 110,
+ 'resize' => TRUE,
+ "media_buttons" => FALSE,
+ "drag_drop_upload" => TRUE,
+ "editor_css" => "",
+ "teeny" => FALSE,
+ 'quicktags' => TRUE,
+ 'wpautop' => FALSE,
+ 'textarea_name' => $editor_id,
+ 'tinymce'=> array('toolbar1' => 'bold,italic,underline,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,alignjustify,link,unlink,table,undo,redo,fullscreen', 'toolbar2' => 'formatselect,fontsizeselect,fontselect,forecolor,backcolor,indent,outdent,pastetext,removeformat,charmap,code', 'toolbar3' => 'custom_template_button_1,custom_template_button_2')
+ );
+ wp_editor( stripslashes($this->options['asm_template_content']), $editor_id, $settings );
+ ?>
+
Instructions
@@ -348,12 +389,13 @@
-
-
+ current_user_can_modify()) echo '
+
+ ';?>
Generate Meeting List '; ?>
Save Changes before Generate Meeting List.
diff --git a/readme.txt b/readme.txt
index be42f61..5320b6b 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,8 +4,8 @@ Contributors: odathp, radius314, pjaudiomv, klgrimley, jbraswell, otrok7
Tags: meeting list, bmlt, narcotics anonymous, na
Requires at least: 4.0
Requires PHP: 5.6
-Tested up to: 5.2.1
-Stable tag: 1.10.1
+Tested up to: 5.2.2
+Stable tag: 2.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
A web-based tool that creates, maintains and generates a PDF meeting list from BMLT.
@@ -54,8 +54,15 @@ Follow all these steps, keep in mind that once you start using bread, it's not g
== Changelog ==
-= 1.10.1 =
-* Fix for detailed formats not rendering [#82]
+= 2.0.0 =
+* Support for multiple configurations. [#36]
+* Access to configure is now controlled with a custom capability called `manage_bread`. This is automatically added to the `Administrator` role.
+* Generalized ASM functionality to other formats, and user-defined templates. Now called "Additional List".
+* German and Farsi support.
+* New layout options
+ - A6 Booklet (fits more meetings than flyer, but more convenient to carry around than A5).
+ - Watermarks (typically the NA Logo, but you can specify a URL to another image).
+ - Page Headers (good when generating posters).
= 1.10.0 =
* Limiting query size to needed fields.