Plugin Directory

Changeset 2006543


Ignore:
Timestamp:
01/04/2019 09:43:12 PM (7 years ago)
Author:
radius314
Message:

Preparing for 1.9.0 release

Location:
bread/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • bread/trunk/Dockerfile

    r1971708 r2006543  
    1919    && echo "xdebug.remote_autostart=1" >> ${PHP_INI_PATH} \
    2020    && echo "xdebug.remote_log=/tmp/xdebug.log" >> ${PHP_INI_PATH} \
     21    && echo "xdebug.profiler_enable_trigger=1" >> ${PHP_INI_PATH} \
    2122    && echo "log_errors = On" >> ${PHP_INI_PATH} \
    2223    && echo "error_reporting = E_ALL" >> ${PHP_INI_PATH} \
  • bread/trunk/bmlt-meeting-list.php

    r1971708 r2006543  
    55Description: Maintains and generates a PDF Meeting List from BMLT.
    66Author: odathp, radius314, pjaudiomv, klgrimley
    7 Version: 1.8.0
     7Version: 1.9.0
    88*/
    99/* Disallow direct access to the plugin file */
     
    183183        }
    184184
    185         function getday( $day, $abbreviate = false, $language = '' ) {
    186            
     185        function getday( $day, $abbreviate = false, $language = '') {
    187186            $data = '';
    188187            if ( $day == 1 ) {
     
    201200                } elseif ( $language == 'fr_en' ) {
    202201                    $data = ($abbreviate ? 'Dim / Sun' : "Dimanche / Sunday");
    203                 }               
     202                } elseif ( $language == 'se') {
     203                    $data = ($abbreviate ? "Sön" : "Söndag");
     204                }
    204205            } elseif ( $day == 2 ) {
    205206                if ( $language == 'en' || $language == 'en' ) {
     
    217218                } elseif ( $language == 'fr_en' ) {
    218219                    $data = ($abbreviate ? 'Lun / Mon' : "Lundi / Monday");
    219                 }               
     220                } elseif ( $language == 'se') {
     221                    $data = ($abbreviate ? "Mån" : "Måndag");
     222                }
    220223            } elseif ( $day == 3 ) {
    221224                if ( $language == 'en' || $language == 'en' ) {
     
    233236                } elseif ( $language == 'fr_en' ) {
    234237                    $data = ($abbreviate ? 'Mar / Tues' : "Mardi / Tuesday");
    235                 }               
     238                } elseif ( $language == 'se') {
     239                    $data = ($abbreviate ? "Tis" : "Tisdag");
     240                }
    236241            } elseif ( $day == 4 ) {
    237242                if ( $language == 'en' || $language == 'en' ) {
     
    249254                } elseif ( $language == 'fr_en' ) {
    250255                    $data = ($abbreviate ? 'Mer / Wed' : "Mercredi / Wednesday");
    251                 }               
     256                } elseif ( $language == 'se') {
     257                    $data = ($abbreviate ? "Ons" : "Onsdag");
     258                }
    252259            } elseif ( $day == 5 ) {
    253260                if ( $language == 'en' || $language == 'en' ) {
     
    265272                } elseif ( $language == 'fr_en' ) {
    266273                    $data = ($abbreviate ? 'Jeu / Thu' : "Jeudi / Thursday");
    267                 }               
     274                } elseif ( $language == 'se') {
     275                    $data = ($abbreviate ? "Tors" : "Torsdag");
     276                }
    268277            } elseif ( $day == 6 ) {
    269278                if ( $language == 'en' || $language == 'en' ) {
     
    281290                } elseif ( $language == 'fr_en' ) {
    282291                    $data = ($abbreviate ? 'Ven / Fri' : "Vendredi / Friday");
    283                 }               
     292                } elseif ( $language == 'se') {
     293                    $data = ($abbreviate ? "Fre" : "Fredag");
     294                }
    284295            } elseif ( $day == 7 ) {
    285296                if ( $language == 'en' || $language == 'en' ) {
     
    297308                } elseif ( $language == 'fr_en' ) {
    298309                    $data = ($abbreviate ? 'Sam / Sat' : "Samedi / Saturday");
    299                 }               
     310                } elseif ( $language == 'se') {
     311                    $data = ($abbreviate ? "Lör" : "Lördag");
     312                }
    300313            }
    301314           
     
    338351        }
    339352
    340         function get_all_meetings ( ) {
     353        function get_all_meetings() {
    341354            $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");
    342355            $result = json_decode(wp_remote_retrieve_body($results),true);
     
    543556            if ( !isset($this->options['base_font']) ) {$this->options['base_font'] = 'dejavusanscondensed';}
    544557            if ( !isset($this->options['weekday_language']) ) {$this->options['weekday_language'] = 'en';}
     558            if ( !isset($this->options['weekday_start']) ) {$this->options['weekday_start'] = '1';}
    545559            if ( !isset($this->options['include_asm']) ) {$this->options['include_asm'] = '0';}
    546560            if ( !isset($this->options['header_uppercase']) ) {$this->options['header_uppercase'] = '0';}
     
    747761                $extra_results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults&sort_keys=".$sort_keys."".$extras."".$get_used_formats );
    748762                $extra_result = json_decode(wp_remote_retrieve_body($extra_results), true);
    749                 if ( $extra_result <> Null ) {
     763                if ( $extra_result <> null ) {
    750764                    $result_meetings = array_merge($result['meetings'], $extra_result['meetings']);
    751765                    foreach ($result_meetings as $key => $row) {
     
    765779            }
    766780
    767             if ( $result_meetings == Null ) {
     781            if ( $result_meetings == null ) {
    768782                echo "<script type='text/javascript'>\n";
    769783                echo "document.body.innerHTML = ''";
     
    811825            $unique_data = array();
    812826
     827            $days = array_column($result_meetings, 'weekday_tinyint');
     828            $today_str = $this->options['weekday_start'];
     829            $result_meetings = array_merge(
     830                array_splice($result_meetings, array_search($today_str, $days)),
     831                array_splice($result_meetings, 0)
     832            );
     833
    813834            foreach ($result_meetings as $value) {
    814                 $result_meetings_temp[] = $value;
    815835                $unique_states[] = $value['location_province'];
    816836                if ( $this->options['meeting_sort'] === 'state' ) {
     
    847867                } elseif ( $this->options['meeting_sort'] === 'weekday_city' ) {
    848868                    $unique_data[] = $value['weekday_tinyint'] . ',' . $value['location_municipality'];
    849                 } elseif ( $this->options['meeting_sort'] === 'weekday_county' ) {
     869                } elseif ( $this->options['meeting_sort'] === 'weekday_county' ) {
    850870                    $unique_data[] = $value['weekday_tinyint'] . ',' . $value['location_sub_province'];
    851871                } else {
     
    855875
    856876            $unique_states = array_unique($unique_states);
    857             asort($unique_data, SORT_NATURAL | SORT_FLAG_CASE);
     877            if (strpos($this->options['meeting_sort'], "weekday") === false && strpos($this->options['meeting_sort'], "day") === false) {
     878                asort($unique_data, SORT_NATURAL | SORT_FLAG_CASE);
     879            }
     880
    858881            $unique_data = array_unique($unique_data);
    859882            if ( $this->options['page_fold'] === 'full' || $this->options['page_fold'] === 'half' ) {
     
    902925
    903926                if ( $this->options['meeting_sort'] === 'weekday_area' || $this->options['meeting_sort'] === 'weekday_city' || $this->options['meeting_sort'] === 'weekday_county' ) {
    904                     $current_weekday = 1;
     927                    $current_weekday = intval($this->options['weekday_start']);
    905928                    $show_first_weekday = true;
    906929                }
     
    911934                        if ( $weekday_tinyint !== $current_weekday ) {
    912935                            $current_weekday++;
     936                            if ($current_weekday > 7) {
     937                                $current_weekday = 1;
     938                            }
    913939                            $show_first_weekday = true;
    914940                        }
     
    916942                    $newVal = true;
    917943                    if ( $this->options['meeting_sort'] === 'state' && strpos($this_unique_value, $this_state) === false ) { continue; }
     944
    918945                    foreach ($result_meetings as $meeting_value) {         
    919946                        if ( $this->options['meeting_sort'] === 'weekday_area' || $this->options['meeting_sort'] === 'weekday_city' || $this->options['meeting_sort'] === 'weekday_county' ) {
     
    963990                        $header = '';
    964991                       
    965                         if ( $this->lang == 'fr' ) {                           
     992                        if ( $this->options['weekday_language'] === 'fr' ) {
    966993                            $cont = '(suite)';                         
    967                         } else {                           
     994                        } else if ( $this->options['weekday_language'] === 'se' ) {
     995                            $cont = '(forts)';
     996                        } else {
    968997                            $cont = '(cont)';                           
    969998                        }
     
    9761005
    9771006                                if ( $this->options['meeting_sort'] === 'borough' ) {
    978 
    9791007                                    if ( $this_unique_value == '' ) {
    980 
    9811008                                        $this_unique_data = '[NO BOROUGH DATA]';
    982 
    9831009                                    } else {
    9841010                                        $this_unique_data = $this_unique_value;
    985 
    9861011                                    }
    9871012                                    $header_suffix = $this->options['borough_suffix'];
    988 
    9891013                                }
    9901014                                if ( $this->options['meeting_sort'] === 'county' ) {
    991 
    9921015                                    if ( $this_unique_value == '' ) {
    993 
    9941016                                        $this_unique_data = '[NO COUNTY DATA]';
    995 
    9961017                                    } else {
    9971018                                        $this_unique_data = $this_unique_value;
    998 
    9991019                                    }
    10001020                                    $header_suffix = $this->options['county_suffix'];
    1001 
    10021021                                }
    10031022                                if ( $newVal ) {
     
    10321051                                if ( $newVal ) {
    10331052                                    if ( $show_first_weekday === true ) {
    1034                                         if ( $current_weekday === 1 ) {
     1053                                        if ( $current_weekday === $this->options['weekday_start'] ) {
    10351054                                            $header .= "<h2 style='".$header_style."'>".$this->getday($meeting_value['weekday_tinyint'], false, $this->options['weekday_language'])."</h2>";
    10361055                                        } else {
     
    11061125                            $space = '';
    11071126                        }
    1108                         if ( $this->options['time_clock'] == Null || $this->options['time_clock'] == '12' || $this->options['time_option'] == '' ) {
     1127                        if ( $this->options['time_clock'] == null || $this->options['time_clock'] == '12' || $this->options['time_option'] == '' ) {
    11091128                            $time_format = "g:i".$space."A";
    11101129                           
     
    14461465            $this->options['front_page_content'] = mb_convert_encoding($this->options['front_page_content'], 'HTML-ENTITIES');
    14471466            $this->mpdf->WriteHTML(utf8_encode(wpautop(stripslashes($this->options['front_page_content']))));
    1448            
     1467
    14491468        }
    14501469
     
    15931612        function admin_menu_link()  {
    15941613            global $my_admin_page;
    1595             $my_admin_page = add_menu_page( 'Meeting List', 'Meeting List', 'edit_posts', basename(__FILE__), array(&$this, 'admin_options_page'), 'dashicons-admin-page');
     1614            $my_admin_page = add_menu_page( 'Meeting List', 'Meeting List', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page'), 'dashicons-admin-page');
    15961615        }
    15971616
     
    16881707                $this->options['include_protection'] = boolval($_POST['include_protection']);
    16891708                $this->options['weekday_language'] = sanitize_text_field($_POST['weekday_language']);
     1709                $this->options['weekday_start'] = sanitize_text_field($_POST['weekday_start']);
    16901710                $this->options['include_asm'] = boolval($_POST['include_asm']);
    16911711                $this->options['bmlt_login_id'] = sanitize_text_field($_POST['bmlt_login_id']);
     
    18571877            if ( !isset($this->options['weekday_language']) || strlen(trim($this->options['weekday_language'])) == 0 ) {
    18581878                $this->options['weekday_language'] = 'en';
    1859             }           
     1879            }
     1880            if ( !isset($this->options['weekday_start']) || strlen(trim($this->options['weekday_start'])) == 0 ) {
     1881                $this->options['weekday_start'] = '1';
     1882            }
    18601883            if ( !isset($this->options['include_asm']) || strlen(trim($this->options['include_asm'])) == 0 ) {
    18611884                $this->options['include_asm'] = '0';
  • bread/trunk/contribute.md

    r1964360 r2006543  
    1414
    1515Now you can make edits to the bmlt-meeting-list.php file and it will instantly take effect.
     16
     17To profile a PHP page, include `XDEBUG_PROFILE` as part of the querystring.  The result will be in `/tmp/cachegrind.out.???`, the extension being the process ID. 
     18
     19You can then open this file in IntelliJ, Valgrind, or any other tool that let's you review an Xdebug profiler result.
     20
     21If you are using a mac for development and Homebrew, this is a fairly easy way to get going.
     22
     23`brew install qcachegrind --with-graphviz`
  • bread/trunk/js/bmlt_meeting_list.js

    r1964355 r2006543  
    365365    if (meeting_sort_val === 'day' || meeting_sort_val === 'weekday_area' || meeting_sort_val === 'weekday_city' ||  meeting_sort_val === 'weekday_county') {
    366366        $ml('.weekday_language_div').show();
     367        $ml('.weekday_start_div').show();
    367368    } else {
    368369        $ml('.weekday_language_div').hide();
     370        $ml('.weekday_start_div').hide();
    369371    }
    370372     $ml('.borough_by_suffix').hide();
     
    391393        $ml('.city_by_suffix').hide();
    392394        if (meeting_sort_val === 'day' || meeting_sort_val === 'weekday_area' || meeting_sort_val === 'weekday_city' ||  meeting_sort_val === 'weekday_county') {
    393             $ml('.weekday_language_div').show();
     395            $ml('.weekday_language_div').show()
     396            $ml('.weekday_start_div').show();
    394397        } else {
    395398            $ml('.weekday_language_div').hide();
     399            $ml('.weekday_start_div').hide();
    396400        }
    397401        if (meeting_sort_val === 'borough_county') {
  • bread/trunk/partials/_meetings_setup.php

    r1964355 r2006543  
    9797                        </p>
    9898                    </div>
    99 
    100                         <div class="weekday_language_div" style="display: inline;">
    101                             <label for="weekday_language">Weekday Language: </label>                                           
    102                             <select name="weekday_language">
    103                             <?php if ( $this->options['weekday_language'] == 'en' || $this->options['weekday_language'] == '' ) { ?>
    104                                 <option selected="selected" value="en">English</option>
    105                                 <option value="es">Spanish</option>
    106                                 <option value="fr">French</option>
    107                                 <option value="po">Portuguese</option>
    108                                 <option value="both">English/Spanish</option>
    109                                 <option value="both_po">English/Spanish/Portuguese</option>
    110                                 <option value="fr_en">French/English</option>
    111                             <?php } elseif ( $this->options['weekday_language'] == 'es' ) { ?>
    112                                 <option selected="selected" value="es">Spanish</option>
    113                                 <option value="en">English</option>
    114                                 <option value="fr">French</option>
    115                                 <option value="po">Portuguese</option>
    116                                 <option value="both">English/Spanish</option>
    117                                 <option value="both_po">English/Spanish/Portuguese</option>
    118                                 <option value="fr_en">French/English</option>
    119                             <?php } elseif ( $this->options['weekday_language'] == 'both' ) { ?>
    120                                 <option selected="selected" value="both">English/Spanish</option>
    121                                 <option value="en">English</option>
    122                                 <option value="es">Spanish</option>
    123                                 <option value="fr">French</option>
    124                                 <option value="po">Portuguese</option>
    125                                 <option value="both_po">English/Spanish/Portuguese</option>
    126                                 <option value="fr_en">French/English</option>
    127                             <?php } elseif ( $this->options['weekday_language'] == 'fr' ) { ?>
    128                                 <option selected="selected" value="fr">French</option>
    129                                 <option value="en">English</option>
    130                                 <option value="es">Spanish</option>
    131                                 <option value="po">Portuguese</option>
    132                                 <option value="both">English/Spanish</option>
    133                                 <option value="both_po">English/Spanish/Portuguese</option>
    134                                 <option value="fr_en">French/English</option>
    135                             <?php } elseif ( $this->options['weekday_language'] == 'po' ) { ?>
    136                                 <option selected="selected" value="po">Portuguese</option>
    137                                 <option value="en">English</option>
    138                                 <option value="es">Spanish</option>
    139                                 <option value="fr">French</option>
    140                                 <option value="both">English/Spanish</option>
    141                                 <option value="both_po">English/Spanish/Portuguese</option>
    142                                 <option value="fr_en">French/English</option>
    143                             <?php } elseif ( $this->options['weekday_language'] == 'fr_en' ) { ?>
    144                                 <option selected="selected" value="fr_en">French/Engish</option>
    145                                 <option value="en">English</option>
    146                                 <option value="es">Spanish</option>
    147                                 <option value="fr">French</option>
    148                                 <option value="po">Portuguese</option>
    149                                 <option value="both">English/Spanish</option>
    150                                 <option value="both_po">English/Spanish/Portuguese</option>
    151                             <?php } elseif ( $this->options['weekday_language'] == 'both_po' ) { ?>
    152                                 <option selected="selected" value="both_po">English/Spanish/Portuguese</option>
    153                                 <option value="en">English</option>
    154                                 <option value="es">Spanish</option>
    155                                 <option value="fr">French</option>
    156                                 <option value="po">Portuguese</option>
    157                                 <option value="both">English/Spanish</option>
    158                                 <option value="fr_en">French/English</option>
    159                             <?php } ?>
    160                             </select>
    161                         </div>
     99                    <?php
     100                        $languages = [
     101                                "en" => "English",
     102                                "fr" => "French",
     103                                "po" => "Portuguese",
     104                                "both" => "English/Spanish",
     105                                "both_po" => "English/Spanish/Portuguese",
     106                                "fr_en" => "French/English",
     107                                "se" => "Swedish"
     108                        ];
     109                    ?>
     110                    <div class="weekday_language_div">
     111                        <label for="weekday_language">Weekday Language: </label>
     112                        <select name="weekday_language">
     113                        <?php
     114                            foreach ($languages as $key => $value) {
     115                                if ($this->options['weekday_language'] == $key || $this->options['weekday_language'] == '' ) {
     116                                    echo "<option value=\"$key\" selected=\"selected\">$value</option>";
     117                                } else {
     118                                    echo "<option value=\"$key\">$value</option>";
     119                                }
     120                            }
     121                        ?>
     122                        </select>
     123                    </div>
     124
     125                    <div class="weekday_start_div">
     126                        <label for="weekday_start">Weekday Start: </label>
     127                        <select name="weekday_start">
     128                            <?php
     129                            for ($d = 1; $d <= 7; $d++) {
     130                                if ($this->options['weekday_start'] == $d || $this->options['weekday_start'] == '' ) {
     131                                    echo "<option value=\"$d\" selected=\"selected\">" . $this->getday($d, false, $this->options['weekday_language']) . "</option>";
     132                                } else {
     133                                    echo "<option value=\"$d\">" . $this->getday($d, false, $this->options['weekday_language']) . "</option>";
     134                                }
     135                            }
     136                            ?>
     137                        </select>
     138                    </div>
    162139                    <p>
    163140                </div>
  • bread/trunk/readme.txt

    r1971708 r2006543  
    66Requires PHP: 5.6
    77Tested up to: 5.0.0
    8 Stable tag: 1.8.0
     8Stable tag: 1.9.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5454
    5555== Changelog ==
     56
     57= 1.9.0 =
     58* Added a feature to change the start day of the week [#55]
     59* Support for Swedish, better language support overall [#54]
     60* Only allow Administrator role to see the plugin (specifically manage_options permission flag) [#53]
    5661
    5762= 1.8.0 =
Note: See TracChangeset for help on using the changeset viewer.