Changeset 3470303
- Timestamp:
- 02/26/2026 01:23:28 PM (4 weeks ago)
- Location:
- blocks-for-churchsuite/trunk
- Files:
-
- 2 added
- 23 edited
-
blocks-for-churchsuite.php (modified) (1 diff)
-
blocks/build/blocks-manifest.php (modified) (4 diffs)
-
blocks/build/cs-calendar/block.json (modified) (1 diff)
-
blocks/build/cs-event-cards/block.json (modified) (1 diff)
-
blocks/build/cs-event-list/block.json (modified) (1 diff)
-
blocks/build/cs-smallgroups/block.json (modified) (1 diff)
-
blocks/build/inc/class-cs-calendar-event-view.php (modified) (2 diffs)
-
blocks/build/inc/class-cs-calendar-renderer.php (modified) (7 diffs)
-
blocks/build/inc/class-cs-compact-event-view.php (modified) (4 diffs)
-
blocks/build/inc/class-cs-event-card-view.php (modified) (4 diffs)
-
blocks/build/inc/class-cs-event-list-renderer.php (modified) (3 diffs)
-
blocks/build/inc/class-cs-group.php (modified) (3 diffs)
-
blocks/src/cs-calendar/block.json (modified) (1 diff)
-
blocks/src/cs-event-cards/block.json (modified) (1 diff)
-
blocks/src/cs-event-list/block.json (modified) (1 diff)
-
blocks/src/cs-smallgroups/block.json (modified) (1 diff)
-
blocks/src/inc/class-cs-calendar-event-view.php (modified) (2 diffs)
-
blocks/src/inc/class-cs-calendar-renderer.php (modified) (7 diffs)
-
blocks/src/inc/class-cs-compact-event-view.php (modified) (4 diffs)
-
blocks/src/inc/class-cs-date-utilities.php (added)
-
blocks/src/inc/class-cs-event-card-view.php (modified) (4 diffs)
-
blocks/src/inc/class-cs-event-list-renderer.php (modified) (3 diffs)
-
blocks/src/inc/class-cs-group.php (modified) (3 diffs)
-
blocks/src/inc/index.php (added)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
blocks-for-churchsuite/trunk/blocks-for-churchsuite.php
r3468626 r3470303 4 4 * Plugin URI: https://github.com/AlwynBarry/blocks-for-churchsuite 5 5 * Description: Gutenberg blocks to display Data for Events and SmallGroups from ChurchSuite 6 * Version: 1.0. 26 * Version: 1.0.3 7 7 * Requires at least: 6.7 8 8 * Requires PHP: 8.0 -
blocks-for-churchsuite/trunk/blocks/build/blocks-manifest.php
r3468626 r3470303 6 6 'apiVersion' => 3, 7 7 'name' => 'b4cs/cs-calendar', 8 'version' => '1.0. 2',8 'version' => '1.0.3', 9 9 'title' => 'Calendar for ChurchSuite', 10 10 'category' => 'widgets', … … 73 73 'apiVersion' => 3, 74 74 'name' => 'b4cs/cs-event-cards', 75 'version' => '1.0. 2',75 'version' => '1.0.3', 76 76 'title' => 'Event Cards for ChurchSuite', 77 77 'category' => 'widgets', … … 164 164 'apiVersion' => 3, 165 165 'name' => 'b4cs/cs-event-list', 166 'version' => '1.0. 2',166 'version' => '1.0.3', 167 167 'title' => 'Event List for ChurchSuite', 168 168 'category' => 'widgets', … … 255 255 'apiVersion' => 3, 256 256 'name' => 'b4cs/cs-smallgroups', 257 'version' => '1.0. 2',257 'version' => '1.0.3', 258 258 'title' => 'Small Groups for ChurchSuite', 259 259 'category' => 'widgets', -
blocks-for-churchsuite/trunk/blocks/build/cs-calendar/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-calendar", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Calendar for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/build/cs-event-cards/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-event-cards", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Event Cards for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/build/cs-event-list/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-event-list", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Event List for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/build/cs-smallgroups/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-smallgroups", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Small Groups for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-calendar-event-view.php
r3388993 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 81 83 $event_time = ''; 82 84 if ( $this->cs_event->is_start_date() ) { 83 $event_time .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . date_format( $this->cs_event->get_start_date(), 'g:ia') . '</span>';84 $event_time .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . date_format( $this->cs_event->get_end_date(), 'g:ia') . '</span>' : '';85 $event_time .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 86 $event_time .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' : ''; 85 87 $event_time .= '</div>' . "\n"; 86 88 } -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-calendar-renderer.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-renderer.php'; … … 9 10 require_once plugin_dir_path( __FILE__ ) . 'class-cs-calendar-event-view.php'; 10 11 12 use amb_dev\b4cs\Cs_Date_Utilities; 11 13 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 12 14 use amb_dev\b4cs\Cs_Renderer as Cs_Renderer; … … 51 53 * Constant values created to prevent unnecessary re-creation of values used in expressions 52 54 */ 53 protected \IntlDateFormatter $shortDayFormat;54 protected \IntlDateFormatter $shortMonthFormat;55 protected \IntlDateFormatter $longMonthFormat;56 55 protected readonly \DateInterval $one_day; 57 56 protected readonly \DateInterval $one_week; 58 57 protected readonly \DateInterval $one_month; 59 58 protected readonly string $page_url; 59 60 60 protected \DateTime $today; 61 61 protected \DateTime $requested_date; … … 76 76 */ 77 77 public function __construct( $atts ) { 78 // Set the date formatters used to remove repeated instance creation79 // TEST: \Locale::setDefault('de-DE');80 $this->shortDayFormat = datefmt_create(81 \Locale::getDefault(),82 \IntlDateFormatter::FULL,83 \IntlDateFormatter::NONE,84 null,85 \IntlDateFormatter::GREGORIAN,86 'EEE'87 );88 $this->shortMonthFormat = datefmt_create(89 \Locale::getDefault(),90 \IntlDateFormatter::FULL,91 \IntlDateFormatter::NONE,92 null,93 \IntlDateFormatter::GREGORIAN,94 'MMM'95 );96 $this->longMonthFormat = datefmt_create(97 \Locale::getDefault(),98 \IntlDateFormatter::FULL,99 \IntlDateFormatter::NONE,100 null,101 \IntlDateFormatter::GREGORIAN,102 'MMMM'103 );104 78 105 79 // Set the date constants used to remove repeated instance creation … … 258 232 . ' <div class="b4cs-calendar-month-header">' . "\n" 259 233 . ' <div class="b4cs-calendar-month-title">' . "\n" 260 . ' ' . datefmt_format($this->longMonthFormat, $date) . ' ' . $date->format( 'Y' ) . "\n" /* . ' ' . $date->format( 'F' ) . ' ' . $date->format( 'Y' ) . "\n" */234 . ' ' . Cs_Date_Utilities::get_month_name_by_locale( $date ) . ' ' . Cs_Date_Utilities::get_year_by_locale( $date ) . "\n" 261 235 . ' </div>' . "\n" 262 236 . ' <div class="b4cs-calendar-month-nav">' . "\n" … … 279 253 $period = new \DatePeriod( $sunday_date, $this->one_day, $saturday_date ); 280 254 foreach ( $period as $day ) { 281 /* $output .= ' <div class="b4cs-calendar-day-name-cell">' . $day->format( 'D' ) . '</div>' . "\n"; */ 282 $output .= ' <div class="b4cs-calendar-day-name-cell">' . datefmt_format($this->shortDayFormat, $day) . '</div>' . "\n"; 255 $output .= ' <div class="b4cs-calendar-day-name-cell">' . Cs_Date_Utilities::get_short_day_name_by_locale( $day ) . '</div>' . "\n"; 283 256 } 284 257 … … 320 293 $day = (int) $date->format( 'j' ); 321 294 $output .= ' <div class="b4cs-date' . ( ( $day === 1 ) ? ' b4cs-first-day' : '' ) . '">' . "\n"; 322 $output .= ' <span class="b4cs-day">' . $date->format( 'D' ) . '</span>' . "\n"; 323 $output .= ' <span class="b4cs-date-number">' . $day . '</span>' . "\n"; 324 $output .= ' <span class="b4cs-month">' . datefmt_format($this->shortMonthFormat, $date) . '</span>' . "\n"; 325 /* $output .= ' <span class="b4cs-month">' . $date->format( 'F' ) . '</span>' . "\n"; */ 326 $output .= ' <span class="b4cs-year">' . $date->format( 'Y' ) . '</span>' . "\n"; 295 $output .= ' <span class="b4cs-day">' . Cs_Date_Utilities::get_day_name_by_locale( $date ) . '</span>' . "\n"; 296 $output .= ' <span class="b4cs-date-number">' . Cs_Date_Utilities::get_day_number_by_locale( $date ) . '</span>' . "\n"; 297 $output .= ' <span class="b4cs-month">' . Cs_Date_Utilities::get_short_month_name_by_locale( $date ) . '</span>' . "\n"; 298 $output .= ' <span class="b4cs-year">' . Cs_Date_Utilities::get_year_by_locale( $date ) . '</span>' . "\n"; 327 299 $output .= ' </div>'; 328 300 // Output the start of the div containing the details of the events on this date -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-compact-event-view.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 32 34 33 35 /* 34 * Constant values created to prevent unnecessary re-creation of values used in expressions35 */36 protected \IntlDateFormatter $timeFormat;37 38 /*39 36 * The event to be displayed, set via the constructor 40 37 * @since 1.0.0 … … 56 53 parent::__construct( $cs ); 57 54 $this->cs_event = $cs_event; 58 $this->set_date_formatters();59 }60 61 /*62 * Set the 'constant' values used to remove repeated instance creation of the required date formatters.63 */64 private function set_date_formatters() {65 // Set the date formatters used to remove repeated instance creation66 $this->timeFormat = datefmt_create(67 \Locale::getDefault(),68 \IntlDateFormatter::NONE,69 \IntlDateFormatter::SHORT,70 null,71 \IntlDateFormatter::GREGORIAN72 );73 55 } 74 56 … … 88 70 // Display the event time and the end time if provided 89 71 if ( $this->cs_event->is_start_date() ) { 90 $output .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_start_date() ) . '</span>';91 $output .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_end_date() ) . '</span>' : '';72 $output .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 73 $output .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' : ''; 92 74 $output .= '</div>' . "\n"; 93 75 } -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-event-card-view.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 32 34 33 35 /* 34 * Constant values created to prevent unnecessary re-creation of values used in expressions35 */36 protected \IntlDateFormatter $monthAndDateFormat;37 protected \IntlDateFormatter $timeFormat;38 39 /*40 36 * The event to be displayed, set via the constructor 41 37 * @since 1.0.0 … … 57 53 parent::__construct( $cs ); 58 54 $this->cs_event = $cs_event; 59 // Set the constant values for the date formatters needed60 $this->set_date_formatters();61 }62 63 /*64 * Set the 'constant' values used to remove repeated instance creation of the required date formatters.65 */66 private function set_date_formatters() {67 // Set the date formatters used to remove repeated instance creation68 // TEST: \Locale::setDefault('de-DE');69 $this->monthAndDateFormat = datefmt_create(70 \Locale::getDefault(),71 \IntlDateFormatter::MEDIUM,72 \IntlDateFormatter::NONE,73 null,74 \IntlDateFormatter::GREGORIAN75 );76 $this->timeFormat = datefmt_create(77 \Locale::getDefault(),78 \IntlDateFormatter::NONE,79 \IntlDateFormatter::SHORT,80 null,81 \IntlDateFormatter::GREGORIAN82 );83 55 } 84 56 … … 113 85 // Display the start and end times where they are provided 114 86 if ( $this->cs_event->is_start_date() ) { 115 $output .= ' <div class="b4cs-date"><span class="b4cs-date-gliph">' . datefmt_format( $this->monthAndDateFormat,$this->cs_event->get_start_date() ) . '</span></div>' . "\n";87 $output .= ' <div class="b4cs-date"><span class="b4cs-date-gliph">' . Cs_Date_Utilities::get_site_formatted_date( $this->cs_event->get_start_date() ) . '</span></div>' . "\n"; 116 88 $output .= ' <div class="b4cs-time">'; 117 $output .= ' <span class="b4cs-time-gliph b4cs-start-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_start_date() ) . '</span>';118 $output .= ( $this->cs_event->is_end_date() ) ? ' - <span class="b4cs-end-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_end_date() ) . '</span>' . "\n" : "\n";89 $output .= ' <span class="b4cs-time-gliph b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 90 $output .= ( $this->cs_event->is_end_date() ) ? ' - <span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' . "\n" : "\n"; 119 91 $output .= ' </div>' . "\n"; 120 92 } -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-event-list-renderer.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-renderer.php'; … … 10 11 require_once plugin_dir_path( __FILE__ ) . 'class-cs-compact-event-view.php'; 11 12 13 use amb_dev\b4cs\Cs_Date_Utilities; 12 14 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 13 15 use amb_dev\b4cs\Cs_Renderer as Cs_Renderer; … … 82 84 protected function display_event_date( \DateTime $event_date ) : string { 83 85 $result = '<div class="b4cs-date">'; 84 $result .= '<span class="b4cs-day">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'EE' ),$event_date ) . '</span>';85 $result .= '<span class="b4cs-date-number">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'dd' ),$event_date ) . '</span>';86 $result .= '<span class="b4cs-month">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'MMM' ),$event_date ) . '</span>';87 $result .= '<span class="b4cs-year">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'yyyy' ),$event_date ) . '</span>';86 $result .= '<span class="b4cs-day">' . Cs_Date_Utilities::get_day_name_by_locale( $event_date ) . '</span>'; 87 $result .= '<span class="b4cs-date-number">' . Cs_Date_Utilities::get_day_number_by_locale( $event_date ) . '</span>'; 88 $result .= '<span class="b4cs-month">' . Cs_Date_Utilities::get_month_name_by_locale( $event_date ) . '</span>'; 89 $result .= '<span class="b4cs-year">' . Cs_Date_Utilities::get_year_by_locale( $event_date ) . '</span>'; 88 90 $result .= '</div>'; 89 91 return $result; -
blocks-for-churchsuite/trunk/blocks/build/inc/class-cs-group.php
r3468626 r3470303 3 3 namespace amb_dev\b4cs; 4 4 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 5 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 6 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-item.php'; 7 9 10 use amb_dev\b4cs\Cs_Date_Utilities; 8 11 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 9 12 use amb_dev\b4cs\Cs_Item as Cs_Item; … … 129 132 $day_of_week_numeric = (int) $group_obj->day; 130 133 if ( ( $day_of_week_numeric >= 0 ) && ( $day_of_week_numeric <= 6 ) ) { 131 $output .= " on ". $dow_text = gmdate( 'l', strtotime( "Sunday +{$day_of_week_numeric} days" ) );134 $output .= __(' on ', 'blocks-for-churchsuite' ) . $dow_text = gmdate( 'l', strtotime( "Sunday +{$day_of_week_numeric} days" ) ); 132 135 } 133 136 } … … 146 149 */ 147 150 protected function fetch_time_of_meeting( \stdclass $group_obj ) : string { 148 // TEST: \Locale::setDefault('de-DE');149 $timeFormat = datefmt_create(150 \Locale::getDefault(),151 \IntlDateFormatter::NONE,152 \IntlDateFormatter::SHORT,153 null,154 \IntlDateFormatter::GREGORIAN155 );156 151 return ( isset( $group_obj->time ) && ( $group_obj->time !== '' ) ) 157 ? datefmt_format( $timeFormat,date_create( $group_obj->time ) )152 ? Cs_Date_Utilities::get_site_formatted_time( date_create( $group_obj->time ) ) 158 153 : '' ; 159 }154 } 160 155 161 156 -
blocks-for-churchsuite/trunk/blocks/src/cs-calendar/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-calendar", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Calendar for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/src/cs-event-cards/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-event-cards", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Event Cards for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/src/cs-event-list/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-event-list", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Event List for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/src/cs-smallgroups/block.json
r3468626 r3470303 3 3 "apiVersion": 3, 4 4 "name": "b4cs/cs-smallgroups", 5 "version": "1.0. 2",5 "version": "1.0.3", 6 6 "title": "Small Groups for ChurchSuite", 7 7 "category": "widgets", -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-calendar-event-view.php
r3388993 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 81 83 $event_time = ''; 82 84 if ( $this->cs_event->is_start_date() ) { 83 $event_time .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . date_format( $this->cs_event->get_start_date(), 'g:ia') . '</span>';84 $event_time .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . date_format( $this->cs_event->get_end_date(), 'g:ia') . '</span>' : '';85 $event_time .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 86 $event_time .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' : ''; 85 87 $event_time .= '</div>' . "\n"; 86 88 } -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-calendar-renderer.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-renderer.php'; … … 9 10 require_once plugin_dir_path( __FILE__ ) . 'class-cs-calendar-event-view.php'; 10 11 12 use amb_dev\b4cs\Cs_Date_Utilities; 11 13 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 12 14 use amb_dev\b4cs\Cs_Renderer as Cs_Renderer; … … 51 53 * Constant values created to prevent unnecessary re-creation of values used in expressions 52 54 */ 53 protected \IntlDateFormatter $shortDayFormat;54 protected \IntlDateFormatter $shortMonthFormat;55 protected \IntlDateFormatter $longMonthFormat;56 55 protected readonly \DateInterval $one_day; 57 56 protected readonly \DateInterval $one_week; 58 57 protected readonly \DateInterval $one_month; 59 58 protected readonly string $page_url; 59 60 60 protected \DateTime $today; 61 61 protected \DateTime $requested_date; … … 76 76 */ 77 77 public function __construct( $atts ) { 78 // Set the date formatters used to remove repeated instance creation79 // TEST: \Locale::setDefault('de-DE');80 $this->shortDayFormat = datefmt_create(81 \Locale::getDefault(),82 \IntlDateFormatter::FULL,83 \IntlDateFormatter::NONE,84 null,85 \IntlDateFormatter::GREGORIAN,86 'EEE'87 );88 $this->shortMonthFormat = datefmt_create(89 \Locale::getDefault(),90 \IntlDateFormatter::FULL,91 \IntlDateFormatter::NONE,92 null,93 \IntlDateFormatter::GREGORIAN,94 'MMM'95 );96 $this->longMonthFormat = datefmt_create(97 \Locale::getDefault(),98 \IntlDateFormatter::FULL,99 \IntlDateFormatter::NONE,100 null,101 \IntlDateFormatter::GREGORIAN,102 'MMMM'103 );104 78 105 79 // Set the date constants used to remove repeated instance creation … … 258 232 . ' <div class="b4cs-calendar-month-header">' . "\n" 259 233 . ' <div class="b4cs-calendar-month-title">' . "\n" 260 . ' ' . datefmt_format($this->longMonthFormat, $date) . ' ' . $date->format( 'Y' ) . "\n" /* . ' ' . $date->format( 'F' ) . ' ' . $date->format( 'Y' ) . "\n" */234 . ' ' . Cs_Date_Utilities::get_month_name_by_locale( $date ) . ' ' . Cs_Date_Utilities::get_year_by_locale( $date ) . "\n" 261 235 . ' </div>' . "\n" 262 236 . ' <div class="b4cs-calendar-month-nav">' . "\n" … … 279 253 $period = new \DatePeriod( $sunday_date, $this->one_day, $saturday_date ); 280 254 foreach ( $period as $day ) { 281 /* $output .= ' <div class="b4cs-calendar-day-name-cell">' . $day->format( 'D' ) . '</div>' . "\n"; */ 282 $output .= ' <div class="b4cs-calendar-day-name-cell">' . datefmt_format($this->shortDayFormat, $day) . '</div>' . "\n"; 255 $output .= ' <div class="b4cs-calendar-day-name-cell">' . Cs_Date_Utilities::get_short_day_name_by_locale( $day ) . '</div>' . "\n"; 283 256 } 284 257 … … 320 293 $day = (int) $date->format( 'j' ); 321 294 $output .= ' <div class="b4cs-date' . ( ( $day === 1 ) ? ' b4cs-first-day' : '' ) . '">' . "\n"; 322 $output .= ' <span class="b4cs-day">' . $date->format( 'D' ) . '</span>' . "\n"; 323 $output .= ' <span class="b4cs-date-number">' . $day . '</span>' . "\n"; 324 $output .= ' <span class="b4cs-month">' . datefmt_format($this->shortMonthFormat, $date) . '</span>' . "\n"; 325 /* $output .= ' <span class="b4cs-month">' . $date->format( 'F' ) . '</span>' . "\n"; */ 326 $output .= ' <span class="b4cs-year">' . $date->format( 'Y' ) . '</span>' . "\n"; 295 $output .= ' <span class="b4cs-day">' . Cs_Date_Utilities::get_day_name_by_locale( $date ) . '</span>' . "\n"; 296 $output .= ' <span class="b4cs-date-number">' . Cs_Date_Utilities::get_day_number_by_locale( $date ) . '</span>' . "\n"; 297 $output .= ' <span class="b4cs-month">' . Cs_Date_Utilities::get_short_month_name_by_locale( $date ) . '</span>' . "\n"; 298 $output .= ' <span class="b4cs-year">' . Cs_Date_Utilities::get_year_by_locale( $date ) . '</span>' . "\n"; 327 299 $output .= ' </div>'; 328 300 // Output the start of the div containing the details of the events on this date -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-compact-event-view.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 32 34 33 35 /* 34 * Constant values created to prevent unnecessary re-creation of values used in expressions35 */36 protected \IntlDateFormatter $timeFormat;37 38 /*39 36 * The event to be displayed, set via the constructor 40 37 * @since 1.0.0 … … 56 53 parent::__construct( $cs ); 57 54 $this->cs_event = $cs_event; 58 $this->set_date_formatters();59 }60 61 /*62 * Set the 'constant' values used to remove repeated instance creation of the required date formatters.63 */64 private function set_date_formatters() {65 // Set the date formatters used to remove repeated instance creation66 $this->timeFormat = datefmt_create(67 \Locale::getDefault(),68 \IntlDateFormatter::NONE,69 \IntlDateFormatter::SHORT,70 null,71 \IntlDateFormatter::GREGORIAN72 );73 55 } 74 56 … … 88 70 // Display the event time and the end time if provided 89 71 if ( $this->cs_event->is_start_date() ) { 90 $output .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_start_date() ) . '</span>';91 $output .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_end_date() ) . '</span>' : '';72 $output .= ' <div class="b4cs-time"><span class="b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 73 $output .= ( $this->cs_event->is_end_date() ) ? '-' . '<span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' : ''; 92 74 $output .= '</div>' . "\n"; 93 75 } -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-event-card-view.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-view.php'; 8 9 require_once plugin_dir_path( __FILE__ ) . 'class-cs-event.php'; 9 10 11 use amb_dev\b4cs\Cs_Date_Utilities; 10 12 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 11 13 use amb_dev\b4cs\Cs_View as Cs_View; … … 32 34 33 35 /* 34 * Constant values created to prevent unnecessary re-creation of values used in expressions35 */36 protected \IntlDateFormatter $monthAndDateFormat;37 protected \IntlDateFormatter $timeFormat;38 39 /*40 36 * The event to be displayed, set via the constructor 41 37 * @since 1.0.0 … … 57 53 parent::__construct( $cs ); 58 54 $this->cs_event = $cs_event; 59 // Set the constant values for the date formatters needed60 $this->set_date_formatters();61 }62 63 /*64 * Set the 'constant' values used to remove repeated instance creation of the required date formatters.65 */66 private function set_date_formatters() {67 // Set the date formatters used to remove repeated instance creation68 // TEST: \Locale::setDefault('de-DE');69 $this->monthAndDateFormat = datefmt_create(70 \Locale::getDefault(),71 \IntlDateFormatter::MEDIUM,72 \IntlDateFormatter::NONE,73 null,74 \IntlDateFormatter::GREGORIAN75 );76 $this->timeFormat = datefmt_create(77 \Locale::getDefault(),78 \IntlDateFormatter::NONE,79 \IntlDateFormatter::SHORT,80 null,81 \IntlDateFormatter::GREGORIAN82 );83 55 } 84 56 … … 113 85 // Display the start and end times where they are provided 114 86 if ( $this->cs_event->is_start_date() ) { 115 $output .= ' <div class="b4cs-date"><span class="b4cs-date-gliph">' . datefmt_format( $this->monthAndDateFormat,$this->cs_event->get_start_date() ) . '</span></div>' . "\n";87 $output .= ' <div class="b4cs-date"><span class="b4cs-date-gliph">' . Cs_Date_Utilities::get_site_formatted_date( $this->cs_event->get_start_date() ) . '</span></div>' . "\n"; 116 88 $output .= ' <div class="b4cs-time">'; 117 $output .= ' <span class="b4cs-time-gliph b4cs-start-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_start_date() ) . '</span>';118 $output .= ( $this->cs_event->is_end_date() ) ? ' - <span class="b4cs-end-time">' . datefmt_format( $this->timeFormat,$this->cs_event->get_end_date() ) . '</span>' . "\n" : "\n";89 $output .= ' <span class="b4cs-time-gliph b4cs-start-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_start_date() ) . '</span>'; 90 $output .= ( $this->cs_event->is_end_date() ) ? ' - <span class="b4cs-end-time">' . Cs_Date_Utilities::get_site_formatted_time( $this->cs_event->get_end_date() ) . '</span>' . "\n" : "\n"; 119 91 $output .= ' </div>' . "\n"; 120 92 } -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-event-list-renderer.php
r3468626 r3470303 4 4 5 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 6 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 7 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-renderer.php'; … … 10 11 require_once plugin_dir_path( __FILE__ ) . 'class-cs-compact-event-view.php'; 11 12 13 use amb_dev\b4cs\Cs_Date_Utilities; 12 14 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 13 15 use amb_dev\b4cs\Cs_Renderer as Cs_Renderer; … … 82 84 protected function display_event_date( \DateTime $event_date ) : string { 83 85 $result = '<div class="b4cs-date">'; 84 $result .= '<span class="b4cs-day">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'EE' ),$event_date ) . '</span>';85 $result .= '<span class="b4cs-date-number">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'dd' ),$event_date ) . '</span>';86 $result .= '<span class="b4cs-month">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'MMM' ),$event_date ) . '</span>';87 $result .= '<span class="b4cs-year">' . datefmt_format( datefmt_create( \Locale::getDefault(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, null, \IntlDateFormatter::GREGORIAN, 'yyyy' ),$event_date ) . '</span>';86 $result .= '<span class="b4cs-day">' . Cs_Date_Utilities::get_day_name_by_locale( $event_date ) . '</span>'; 87 $result .= '<span class="b4cs-date-number">' . Cs_Date_Utilities::get_day_number_by_locale( $event_date ) . '</span>'; 88 $result .= '<span class="b4cs-month">' . Cs_Date_Utilities::get_month_name_by_locale( $event_date ) . '</span>'; 89 $result .= '<span class="b4cs-year">' . Cs_Date_Utilities::get_year_by_locale( $event_date ) . '</span>'; 88 90 $result .= '</div>'; 89 91 return $result; -
blocks-for-churchsuite/trunk/blocks/src/inc/class-cs-group.php
r3468626 r3470303 3 3 namespace amb_dev\b4cs; 4 4 5 6 require_once plugin_dir_path( __FILE__ ) . 'class-cs-date-utilities.php'; 5 7 require_once plugin_dir_path( __FILE__ ) . 'class-churchsuite.php'; 6 8 require_once plugin_dir_path( __FILE__ ) . 'class-cs-item.php'; 7 9 10 use amb_dev\b4cs\Cs_Date_Utilities; 8 11 use amb_dev\b4cs\ChurchSuite as ChurchSuite; 9 12 use amb_dev\b4cs\Cs_Item as Cs_Item; … … 129 132 $day_of_week_numeric = (int) $group_obj->day; 130 133 if ( ( $day_of_week_numeric >= 0 ) && ( $day_of_week_numeric <= 6 ) ) { 131 $output .= " on ". $dow_text = gmdate( 'l', strtotime( "Sunday +{$day_of_week_numeric} days" ) );134 $output .= __(' on ', 'blocks-for-churchsuite' ) . $dow_text = gmdate( 'l', strtotime( "Sunday +{$day_of_week_numeric} days" ) ); 132 135 } 133 136 } … … 146 149 */ 147 150 protected function fetch_time_of_meeting( \stdclass $group_obj ) : string { 148 // TEST: \Locale::setDefault('de-DE');149 $timeFormat = datefmt_create(150 \Locale::getDefault(),151 \IntlDateFormatter::NONE,152 \IntlDateFormatter::SHORT,153 null,154 \IntlDateFormatter::GREGORIAN155 );156 151 return ( isset( $group_obj->time ) && ( $group_obj->time !== '' ) ) 157 ? datefmt_format( $timeFormat,date_create( $group_obj->time ) )152 ? Cs_Date_Utilities::get_site_formatted_time( date_create( $group_obj->time ) ) 158 153 : '' ; 159 }154 } 160 155 161 156 -
blocks-for-churchsuite/trunk/readme.txt
r3468626 r3470303 4 4 * Requires at least: 6.7 5 5 * Tested up to: 6.9.1 6 * Stable tag: 1.0. 26 * Stable tag: 1.0.3 7 7 * License: GPLv2 or later 8 8 … … 265 265 266 266 267 = 1.0.3 = 268 269 **2026-02-26** 270 * Refactored the Locale code to use the wordpress site locale rather than 271 the server locale, and to use the wordpress admin settings for full 272 date or time output. This means the time and date output should always 273 be sympathetic with the Wordpress site settings. Also moved all the 274 time and date string creation to a new module so it can be easily 275 modified without having to update many files. 276 * Version bump to 1.0.3 277 278 267 279 = 1.0.2 = 268 280
Note: See TracChangeset
for help on using the changeset viewer.