Changeset 3429289
- Timestamp:
- 12/29/2025 08:43:31 PM (2 months ago)
- Location:
- lifepress
- Files:
-
- 74 added
- 6 edited
-
tags/2.2.1 (added)
-
tags/2.2.1/README.txt (added)
-
tags/2.2.1/assets (added)
-
tags/2.2.1/assets/admin.css (added)
-
tags/2.2.1/assets/admin.js (added)
-
tags/2.2.1/assets/global.css (added)
-
tags/2.2.1/assets/libs (added)
-
tags/2.2.1/assets/libs/fontawesome (added)
-
tags/2.2.1/assets/libs/fontawesome/all.js (added)
-
tags/2.2.1/assets/libs/fontawesome/all.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/brands.js (added)
-
tags/2.2.1/assets/libs/fontawesome/brands.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/conflict-detection.js (added)
-
tags/2.2.1/assets/libs/fontawesome/conflict-detection.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/fontawesome.js (added)
-
tags/2.2.1/assets/libs/fontawesome/fontawesome.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/regular.js (added)
-
tags/2.2.1/assets/libs/fontawesome/regular.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/solid.js (added)
-
tags/2.2.1/assets/libs/fontawesome/solid.min.js (added)
-
tags/2.2.1/assets/libs/fontawesome/v4-shims.js (added)
-
tags/2.2.1/assets/libs/fontawesome/v4-shims.min.js (added)
-
tags/2.2.1/assets/libs/handlebars.js (added)
-
tags/2.2.1/assets/libs/jquery-ui (added)
-
tags/2.2.1/assets/libs/jquery-ui/images (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-bg_glass_100_f8f8f8_1x400.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-bg_glass_35_dddddd_1x400.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-bg_glass_60_eeeeee_1x400.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-bg_inset-hard_75_999999_1x100.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-bg_inset-soft_50_c9c9c9_1x100.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-icons_3383bb_256x240.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-icons_454545_256x240.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-icons_70b2e1_256x240.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-icons_999999_256x240.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/images/ui-icons_fbc856_256x240.png (added)
-
tags/2.2.1/assets/libs/jquery-ui/jquery-ui.css (added)
-
tags/2.2.1/assets/libs/jquery-ui/jquery-ui.min.css (added)
-
tags/2.2.1/assets/libs/jquery-ui/theme.css (added)
-
tags/2.2.1/assets/libs/spectrum.css (added)
-
tags/2.2.1/assets/libs/spectrum.js (added)
-
tags/2.2.1/assets/libs/trumbowyg (added)
-
tags/2.2.1/assets/libs/trumbowyg/trumbowyg.min.js (added)
-
tags/2.2.1/assets/libs/trumbowyg/ui (added)
-
tags/2.2.1/assets/libs/trumbowyg/ui/icons.svg (added)
-
tags/2.2.1/assets/libs/trumbowyg/ui/trumbowyg.css (added)
-
tags/2.2.1/assets/libs/trumbowyg/ui/trumbowyg.min.css (added)
-
tags/2.2.1/assets/script.js (added)
-
tags/2.2.1/includes (added)
-
tags/2.2.1/includes/admin (added)
-
tags/2.2.1/includes/admin/class-admin-ajax.php (added)
-
tags/2.2.1/includes/admin/class-admin.php (added)
-
tags/2.2.1/includes/class-ajax.php (added)
-
tags/2.2.1/includes/class-entries.php (added)
-
tags/2.2.1/includes/class-entry.php (added)
-
tags/2.2.1/includes/class-frontend.php (added)
-
tags/2.2.1/includes/class-helper.php (added)
-
tags/2.2.1/includes/class-install.php (added)
-
tags/2.2.1/includes/class-lp_type_data.php (added)
-
tags/2.2.1/includes/class-lunisolar.php (added)
-
tags/2.2.1/includes/class-metrics.php (added)
-
tags/2.2.1/includes/class-settings.php (added)
-
tags/2.2.1/includes/class-shortcode.php (added)
-
tags/2.2.1/includes/class-time.php (added)
-
tags/2.2.1/includes/lib (added)
-
tags/2.2.1/includes/lib/MoonPhase.php (added)
-
tags/2.2.1/lang (added)
-
tags/2.2.1/lang/lifepress.mo (added)
-
tags/2.2.1/lang/lifepress.po (added)
-
tags/2.2.1/lifepress.php (added)
-
tags/2.2.1/templates (added)
-
tags/2.2.1/templates/class-template_parts.php (added)
-
tags/2.2.1/templates/dashboard.php (added)
-
tags/2.2.1/templates/header.php (added)
-
tags/2.2.1/uninstall.php (added)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/assets/global.css (modified) (1 diff)
-
trunk/assets/script.js (modified) (10 diffs)
-
trunk/includes/class-ajax.php (modified) (4 diffs)
-
trunk/includes/class-lunisolar.php (modified) (6 diffs)
-
trunk/lifepress.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lifepress/trunk/README.txt
r3428394 r3429289 5 5 Requires at least: 6.0 6 6 Tested up to: 6.9 7 Stable tag: 2.2 7 Stable tag: 2.2.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 42 42 * Developer-friendly with pluggable actions and filters 43 43 44 45 46 == 🌙 Lunisolar Calendar - Moon View (New in 2.2) == 47 48 Switch from the standard calendar to a moon-phase (lunisolar) view and align your journaling with natural rhythms. 49 50 Center your life awareness around: 51 52 * New moons 53 * Full moons 54 * Waxing and waning cycles 55 56 This view is ideal for those who prefer to plan, reflect, and reset in harmony with nature’s cycles rather than purely linear time. 57 44 58 == 🗄️ Data Metrics (New in 2.2) == 45 59 … … 62 76 63 77 Your journal becomes a living dataset of your life. 64 65 == 🌙 Lunisolar Calendar - Moon View (New in 2.2) ==66 67 Switch from the standard calendar to a moon-phase (lunisolar) view and align your journaling with natural rhythms.68 69 Center your life awareness around:70 71 * New moons72 * Full moons73 * Waxing and waning cycles74 75 This view is ideal for those who prefer to plan, reflect, and reset in harmony with nature’s cycles rather than purely linear time.76 78 77 79 … … 130 132 131 133 == Changelog == 134 = 2.2.1 (2025-12-29) = 135 FIXED: Normal calendar to other calendar view not working 136 FIXED: Image view styles and layout 137 FIXED: Moon cycle progress bar adjustment 138 FIXED: Moon month switching not working 139 FIXED: anchor year to moon cycle holding equinox 140 FIXED: moon months per equinox anchor year not correct 141 132 142 = 2.2 (2025-12-27) = 133 143 ADDED: Option to enable Sun and moon information in footer -
lifepress/trunk/assets/global.css
r3428394 r3429289 519 519 padding: 10px; 520 520 } 521 .lp_entry_image img{border-radius: 10px; }521 .lp_entry_image img{border-radius: 10px;max-width: 100%;} 522 522 .lp_editor_box {flex:1;} 523 523 -
lifepress/trunk/assets/script.js
r3428394 r3429289 236 236 237 237 if( 'lunar_data' in data.d){ 238 LUNAR_DATA = data.d.lunar_data; 239 update_lunar_ref( data.d.lunar_data.ref ); 238 LUNAR_DATA = data.d.lunar_data; 240 239 LUNAR_NOW = {'s': data.d.lunar_data.start, 'e': data.d.lunar_data.end}; 241 240 } 241 242 if( 'lunar_data' in data.d) update_lunar_ref( data.d.lunar_data.ref ); 242 243 243 244 … … 291 292 292 293 // adjust focus if direction send 293 if(direction) FOCUS.setMonth( (direction == 'next'? FOCUS.getMonth()+1: FOCUS.getMonth()-1) ); 294 if(direction && direction == 'next' ) FOCUS.setMonth( FOCUS.getMonth()+1 ); 295 if(direction && direction == 'prev' ) FOCUS.setMonth( FOCUS.getMonth()-1 ); 294 296 295 297 // based on focus date set 1st of focus month as start range … … 309 311 // adjust end range to last day of week 310 312 DE.setDate( DE.getDate() + _get_eow_daydif( DE.getDay() ) ); 311 313 314 //console.log('T1 '+ DS); 312 315 } 313 316 if(VIEW == 'moon_view' ){ … … 317 320 if (!FOCUS) FOCUS = new Date(parseInt(LUNAR_DATA.start) * 1000); 318 321 319 DS = new Date( parseInt( LUNAR_DATA.start ) * 1000 ); 320 DE = new Date( parseInt( LUNAR_DATA.end ) * 1000 ); 322 if( !direction ){ 323 DS = new Date( parseInt( LUNAR_DATA.start ) * 1000 ); 324 DE = new Date( parseInt( LUNAR_DATA.end ) * 1000 ); 325 } 326 327 //console.log(LUNAR_DATA); 321 328 322 329 if( direction == 'today'){ … … 327 334 // move focus by ONE lunar cycle 328 335 if (direction === 'next'){ 336 337 //console.log(LUNAR_REF); 338 //console.log(DE.getFullYear()+'-'+ (DE.getMonth()+1) +'-'+ DE.getDate()); 329 339 330 340 DE.setDate( DE.getDate() + 1 ); … … 366 376 } 367 377 378 //console.log(DS); 379 368 380 } 369 381 if(VIEW == 'week_view' ){ … … 434 446 txt = LUNAR_DATA.moon_title ; 435 447 var currentMoonRef = ''; 448 449 console.log(LUNAR_REF); 436 450 437 451 currentMoonRef = LUNAR_REF[ DS.getFullYear()+'-'+ (DS.getMonth()+1) +'-'+ DS.getDate() ]; … … 1179 1193 AJAXDATA['start_u'] = DS.getTime(); 1180 1194 AJAXDATA['end_u'] = DE.getTime(); 1181 AJAXDATA['nonce'] = lp_ajax.lp_nonce; 1195 AJAXDATA['nonce'] = lp_ajax.lp_nonce; 1196 1197 //console.log('T2 '+ DS); 1182 1198 1183 1199 // console.log( LOADED_date_range.s+' '+ AJAXDATA.start_u); … … 1214 1230 } 1215 1231 1232 1216 1233 modify_range_start(); 1217 1234 _draw_entries(); … … 1347 1364 BODY.on('click','.lp_goto_today',function(){ 1348 1365 // set new focus months 1349 FOCUS.setDate( NOW.getDate() );1350 FOCUS.setMonth( NOW.getMonth() );1351 FOCUS.setFullYear( NOW.getFullYear() );1352 1353 modify_range_start('today');1354 1355 _load_new_entry_content_after_set();1366 FOCUS.setDate( NOW.getDate() ); 1367 FOCUS.setMonth( NOW.getMonth() ); 1368 FOCUS.setFullYear( NOW.getFullYear() ); 1369 1370 modify_range_start('today'); 1371 1372 _load_new_entry_content_after_set(); 1356 1373 }); 1357 1374 -
lifepress/trunk/includes/class-ajax.php
r3428394 r3429289 38 38 } 39 39 40 41 40 42 // AJAX endpoints @since 2.1 41 43 public static function define_ajax(){ … … 130 132 $LUNDATA = $LUN->get_moon_data(); 131 133 132 if( $settings->check_yn('_moonview') ){134 if( $settings->check_yn('_moonview') && $settings->get_prop('_dash_def_view') == 'moon_view'){ 133 135 134 136 … … 140 142 141 143 // lunar data 142 $J['d']['lunar_data'] = $LUNDATA;144 143 145 /* 144 146 [ … … 159 161 $date_range = apply_filters('lifepress_ajax_date_range', [$startDate, $DD]); 160 162 } 163 164 $J['d']['lunar_data'] = $LUNDATA; 161 165 162 166 $ENT = new LIFEPRESS_Entries(); -
lifepress/trunk/includes/class-lunisolar.php
r3428394 r3429289 36 36 if( $unix ) $dateTime->setTimestamp( $unix ); 37 37 $dateTime->modify( '+2 days' ); 38 $start TS= clone $dateTime;38 $startDT = clone $dateTime; 39 39 $moonPhase = new MoonPhase($dateTime); 40 40 … … 48 48 $start = (new DateTime('@' . $newMoon))->setTimezone( $this->tz )->setTime(0, 0, 0); 49 49 $end = (new DateTime('@' . $nextNewMoon))->setTimezone( $this->tz )->setTime(0, 0, 0); 50 $total_days = $start->diff($end)->days ;50 $total_days = $start->diff($end)->days + 1; 51 51 $progress = ( $moonAge / $total_days) * 100; 52 52 … … 105 105 106 106 // Other 107 $moon_index = $this->get_current_moon_index( $newMoon );108 $moons_in_year = $this->new_moons_in_year( $start TS);107 $moon_index = $this->get_current_moon_index( $newMoon , $nextNewMoon); 108 $moons_in_year = $this->new_moons_in_year( $startDT ); 109 109 110 110 // month references … … 112 112 $month_ref = [ $this_date => [ $newMoon, $this_cycle_end , __('Moon','lp').' '. $moon_index] ]; 113 113 114 $moon_index_prev = $moon_index - 1 <1 ? 1: $moon_index -1; 115 $prev_date = (new DateTime('', $this->tz ))->setTimestamp( (int) $prevNewMoon )->format('Y-n-j'); 116 //$month_ref[ $prev_year ][ $moon_index_prev ]= [ $prevNewMoon, $prev_cycle_end, __('Moon','lp').' '. ( $moon_index_prev)]; 114 $prevNM_DT = (new DateTime('', $this->tz ))->setTimestamp( (int) $prevNewMoon ); 115 $prev_date = $prevNM_DT->format('Y-n-j'); 116 $moons_in_prev_year = ( $moon_index - 1 < 1) ? $this->new_moons_in_year( $prevNM_DT ):1; 117 $moon_index_prev = $moon_index - 1 < 1 ? $moons_in_prev_year: $moon_index -1; 117 118 $month_ref[ $prev_date ]= [ $prevNewMoon, $prev_cycle_end, __('Moon','lp').' '. ( $moon_index_prev)]; 118 119 … … 121 122 //$month_ref[ $next_year ][ $moon_index_next ]= [ $nextNewMoon, $nextNext_cycle_end , __('Moon','lp').' '. $moon_index_next]; 122 123 $month_ref[ $next_date ]= [ $nextNewMoon, $nextNext_cycle_end , __('Moon','lp').' '. $moon_index_next]; 124 125 //error_log(print_r($prevNM_DT,true)); 126 //error_log(print_r($this->new_moons_in_year( new DateTime('2026-01-18', $this->tz )),true)); 123 127 124 128 … … 154 158 155 159 156 private function get_current_moon_index( int $current_new_moon_ts ): int { 157 $lunar_cycle_seconds = $this->lunar_cycle_days * DAY_IN_SECONDS; 158 159 $year = (int) gmdate('Y', $current_new_moon_ts); 160 private function get_current_moon_index( int $current_new_moon_ts , int $next_new_moon_ts ): int { 161 $year = (new DateTime('', $this->tz ))->setTimestamp( (int) $current_new_moon_ts )->format('Y'); 160 162 $equinox_ts = $this->get_spring_equinox_ts( $year ); 161 163 162 // If this new moon happens before the equinox, 163 // it belongs to the previous lunar year 164 if ( $current_new_moon_ts < $equinox_ts ) { 164 // If this cycle ends before the equinox, it belongs to the previous lunar year 165 if ( $next_new_moon_ts <= $equinox_ts ) { 165 166 $year--; 166 167 $equinox_ts = $this->get_spring_equinox_ts( $year ); 167 168 } 168 169 169 $seconds_since_equinox = $current_new_moon_ts - $equinox_ts; 170 171 $index = (int) floor( $seconds_since_equinox / $lunar_cycle_seconds ) + 1; 172 173 // Safety clamp (some years only reach 12) 174 if ( $index < 1 ) $index = 1; 175 if ( $index > 13 ) $index = 13; 176 177 return $index; 178 } 179 180 public function new_moons_in_year(DateTime $startDate): int { 181 $startTs = $startDate->getTimestamp(); 182 $start_year = $startDate->format('Y'); 183 $end_year = $startDate->format('Y') + 1; 184 185 // before march 20 186 if( $startDate->format('n') <= 3 && $startDate->format('j') <= 20 ){ 187 $start_year = $startDate->format('Y') - 1; 188 $end_year = $startDate->format('Y'); 189 } 190 191 $startTS = $this->get_spring_equinox_ts( $start_year); 192 $endTS = $this->get_spring_equinox_ts( $end_year); 193 194 $count = 0; 195 196 // Start from the nearest previous new moon 197 $moon = new MoonPhase( (new DateTime())->setTimestamp($startTS) ); 198 $currentNewMoon = (int) $moon->getPhasePrevNewMoon(); 199 200 if( $currentNewMoon < $startTS ) $currentNewMoon = (int) $moon->getPhaseNextNewMoon(); 201 202 // Loop through new moons until end date 203 while ($currentNewMoon < $endTS) { 204 $count++; 205 // Move to the next new moon 206 $moon = new MoonPhase((new DateTime())->setTimestamp( (int) $currentNewMoon + 86400)); // next day 207 $currentNewMoon = (int) $moon->getPhaseNextNewMoon(); 208 } 209 210 return $count; 170 // Find Month 1 start: the new moon cycle that CONTAINS the equinox 171 $moon = new MoonPhase( (new DateTime())->setTimestamp( $equinox_ts )); 172 173 $month1_start = (int) $moon->getPhaseNewMoon(); 174 $month1_end = (int) $moon->getPhaseNextNewMoon(); 175 //error_log(print_r( (new DateTime('', $this->tz))->setTimestamp( $month1_start)->format('Y-n-j'),true)); 176 177 // If equinox hits exactly on a new moon boundary 178 if ( $equinox_ts >= $month1_end ) { 179 $month1_start = $month1_end; 180 $moon = new MoonPhase( (new DateTime())->setTimestamp( $month1_start + DAY_IN_SECONDS ) ); 181 $month1_end = (int) $moon->getPhaseNextNewMoon(); 182 } 183 184 // If current cycle IS Month 1 185 if ( 186 $current_new_moon_ts === $month1_start || 187 ( $current_new_moon_ts < $month1_end && $next_new_moon_ts > $month1_start ) 188 ) { 189 return 1; 190 } 191 192 // Count forward from Month 1 until current cycle 193 $index = 1; 194 $ts = $month1_start; 195 196 while ( $ts < $current_new_moon_ts ) { 197 $moon = new MoonPhase( 198 (new DateTime())->setTimestamp( $ts + DAY_IN_SECONDS ) 199 ); 200 $ts = (int) $moon->getPhaseNextNewMoon(); 201 $index++; 202 } 203 204 return min( $index, 13 ); 205 } 206 207 208 209 public function new_moons_in_year(DateTime $date): int { 210 $year = (int) $date->format('Y'); 211 $dateTs = $date->getTimestamp(); 212 213 $equinoxThisYear = $this->get_spring_equinox_ts( $year ); 214 215 // If before equinox, use previous anchor year 216 if ( $dateTs < $equinoxThisYear ) { 217 $year--; 218 $equinoxThisYear = $this->get_spring_equinox_ts( $year ); 219 } 220 221 $equinoxNextYear = $this->get_spring_equinox_ts( $year + 1 ); 222 223 // Month 1 starts at the new moon BEFORE the equinox 224 $moon = new MoonPhase( (new DateTime())->setTimestamp( $equinoxThisYear ) ); 225 $startTS = (int) $moon->getPhasePrevNewMoon(); 226 227 $moon = new MoonPhase( (new DateTime())->setTimestamp( $equinoxNextYear ) ); 228 $endTS = (int) $moon->getPhasePrevNewMoon(); 229 230 $count = 0; 231 for ( $ts = $startTS; $ts < $endTS; ) { 232 $count++; 233 $moon = new MoonPhase( 234 (new DateTime())->setTimestamp( $ts + DAY_IN_SECONDS ) 235 ); 236 $ts = (int) $moon->getPhaseNextNewMoon(); 237 } 238 239 return $count; 211 240 } 212 241 -
lifepress/trunk/lifepress.php
r3428394 r3429289 5 5 * Description: You are the creator of events in your life. Record and track progress in your life. 6 6 * Author: Ashan Jay 7 * Version: 2.2 7 * Version: 2.2.1 8 8 * Requires at least: 6.0 9 9 * Tested up to: 6.9 … … 20 20 class LIFEPRESS{ 21 21 22 public $version='2.2 22 public $version='2.2.1 23 23 '; 24 24 public $name = 'LifePress';
Note: See TracChangeset
for help on using the changeset viewer.