The Lectionary class calculates the holy days over a calendar year. Here is some code that demonstrates how to use the object:


<?

$year 
intval(strftime("%Y",gmmktime()));

require_once(
'Lectionary.class');

// This loads the Lectionary.class and makes it available
$lectionary = new Lectionary();

// Returns an associative array containing the key as the date in seconds
// since January 1, 1970 and the value as the day's Lectionary index number.
$l $lectionary->get_calendar();

// Loop through each date and print it and the day's title and scripture
$page->content .= "<h2> Lectionary for ".$year."</h2>n";
foreach ( 
$l as $key => $val) {
  
$page->content .= '<h3>'.$lectionary->get_title($key,$val).' (Year '.$lectionary->get_cycle($key).")</h3>n";
  
$page->content .= "</p>n";
  
$page->content .= '<b>Date:</b> '.$lectionary->get_long_date($key)."<br />n";
  
$page->content .= '<b>Old Testament:</b> <a href="../bible/?verse=' .
                    
urlencode($lectionary->get_scripture($key,$val,'old')) . '">' .
                    
$lectionary->get_scripture($key,$val,'old')    . "</a><br />n";
  
$page->content .= '<b>Psalms:</b>        <a href="../bible/?verse=' .
                    
urlencode($lectionary->get_scripture($key,$val,'psalms')) .'">'.
                    
$lectionary->get_scripture($key,$val,'psalms') . "</a><br />n";
  
$page->content .= '<b>New Testament:</b> <a href="../bible/?verse=' .
                    
urlencode($lectionary->get_scripture($key,$val,'new'))    .'">'.
                    
$lectionary->get_scripture($key,$val,'new')    . "</a><br />n";
  
$page->content .= '<b>Gospel:</b>        <a href="../bible/?verse=' .
                    
urlencode($lectionary->get_scripture($key,$val,'gospel')) .'">'.
                    
$lectionary->get_scripture($key,$val,'gospel') . "</a><br />n";
  
$page->content .= "</p>n";
}

?>

Here is how that code looks when it is run:

Lectionary for 2017

1st Sunday after Christmas Day (Year A)

Date: Sunday, January 01st, 2017, 11:00
Old Testament: Isa. 63:7-9
Psalms: Ps. 148
New Testament: Heb. 2:10-18
Gospel: Matt. 2:13-23

Epiphany of the Lord (Year A)

Date: Friday, January 06th, 2017, 11:00
Old Testament: Isa. 60:1-6
Psalms: Ps. 72:1-7,10-14
New Testament: Eph. 3:1-12
Gospel: Matt. 2:1-12

Baptism of the Lord (Year A)

Date: Sunday, January 08th, 2017, 11:00
Old Testament: Isa. 42:1-9
Psalms: Ps. 29
New Testament: Acts 10:34-43
Gospel: Matt. 3:13-17

2nd Sunday in Ordinary Time (Year A)

Date: Sunday, January 15th, 2017, 11:00
Old Testament: Isa. 49:1-7
Psalms: Ps. 40:1-11
New Testament: 1 Cor. 1:1-9
Gospel: John 1:29-42

3rd Sunday in Ordinary Time (Year A)

Date: Sunday, January 22nd, 2017, 11:00
Old Testament: Isa. 9:1-4
Psalms: Ps. 27:1,4-9
New Testament: 1 Cor. 1:10-18
Gospel: Matt. 4:12-23

4th Sunday in Ordinary Time (Year A)

Date: Sunday, January 29th, 2017, 11:00
Old Testament: Micah 6:1-8
Psalms: Ps. 15
New Testament: 1 Cor. 1:18-31
Gospel: Matt. 5:1-12

5th Sunday in Ordinary Time (Year A)

Date: Sunday, February 05th, 2017, 11:00
Old Testament: Isa. 58:1-12
Psalms: Ps. 112:1-10
New Testament: 1 Cor. 2:1-16
Gospel: Matt. 5:13-20

6th Sunday in Ordinary Time (Year A)

Date: Sunday, February 12th, 2017, 11:00
Old Testament: Deut. 30:15-20
Psalms: Ps. 119:1-8
New Testament: 1 Cor. 3:1-9
Gospel: Matt. 5:21-37

7th Sunday in Ordinary Time (Year A)

Date: Sunday, February 19th, 2017, 11:00
Old Testament: Lev. 19:1-2,9-18
Psalms: Ps. 119:33-40
New Testament: 1 Cor. 3:10-11,16-23
Gospel: Matt. 5:38-48

Transfiguration of the Lord (Year A)

Date: Sunday, February 26th, 2017, 11:00
Old Testament: Ex. 24:12-18
Psalms: Ps. 2
New Testament: 2 Peter 1:16-21
Gospel: Matt. 17:1-9

Ash Wednesday (Year A)

Date: Wednesday, March 01st, 2017, 11:00
Old Testament: Isa. 58:1-12
Psalms: Ps. 51:1-17
New Testament: 2 Cor. 5:20-6:10
Gospel: Matt. 6:1-6,16-21

1st Sunday in Lent (Year A)

Date: Sunday, March 05th, 2017, 11:00
Old Testament: Gen. 2:15-17; 3:1-7
Psalms: Ps. 32
New Testament: Rom. 5:12-19
Gospel: Matt. 4:1-11

2nd Sunday in Lent (Year A)

Date: Sunday, March 12th, 2017, 11:00
Old Testament: Gen. 12:1-4
Psalms: Ps. 121
New Testament: Rom. 4:1-5,13-17
Gospel: John 3:1-17

3rd Sunday in Lent (Year A)

Date: Sunday, March 19th, 2017, 11:00
Old Testament: Ex. 17:1-7
Psalms: Ps. 95
New Testament: Rom. 5:1-11
Gospel: John 4:5-42

4th Sunday in Lent (Year A)

Date: Sunday, March 26th, 2017, 11:00
Old Testament: 1 Sam. 16:1-13
Psalms: Ps. 23
New Testament: Eph. 5:8-14
Gospel: John 9:1-41

5th Sunday in Lent (Year A)

Date: Sunday, April 02nd, 2017, 11:00
Old Testament: Ezek. 37:1-14
Psalms: Ps. 130
New Testament: Rom. 8:6-11
Gospel: John 11:1-45

Passion/Palm Sunday (Year A)

Date: Sunday, April 09th, 2017, 11:00
Old Testament: Isa. 50:4-9
Psalms: Ps. 118:1-2,19-29
New Testament: Philip. 2:5-11
Gospel: Matt. 21:1-11

Monday of Holy Week (Year A)

Date: Monday, April 10th, 2017, 11:00
Old Testament: Isa. 42:1-9
Psalms: Ps. 36:5-11
New Testament: Heb. 9:11-15
Gospel: John 12:1-11

Tuesday of Holy Week (Year A)

Date: Tuesday, April 11th, 2017, 11:00
Old Testament: Isa. 49:1-7
Psalms: Ps. 71:1-14
New Testament: 1 Cor. 1:18-31
Gospel: John 12:20-36

Wednesday of Holy Week (Year A)

Date: Wednesday, April 12th, 2017, 11:00
Old Testament: Isa. 50:4-9
Psalms: Ps. 70
New Testament: Heb. 12:1-3
Gospel: John 13:21-32

Maundy Thursday (Year A)

Date: Thursday, April 13th, 2017, 11:00
Old Testament: Ex. 12:1-14
Psalms: Ps. 116:1-2,12-19
New Testament: 1 Cor. 11:23-26
Gospel: John 13:1-17,31-35

Good Friday (Year A)

Date: Friday, April 14th, 2017, 11:00
Old Testament: Isa. 52:13-53:12
Psalms: Ps. 22
New Testament: Heb. 10:16-25
Gospel: John 18:1-19:42

Easter Vigil (Year A)

Date: Saturday, April 15th, 2017, 11:00
Old Testament: Gen. 1:1-2:4
Psalms: Ps. 136:1-9,23-26
New Testament: Rom. 6:3-11
Gospel: Matt. 28:1-10

Resurrection of the Lord (Year A)

Date: Sunday, April 16th, 2017, 11:00
Old Testament: Jer. 31:1-6
Psalms: Ps. 118:1-2,14-24
New Testament: Col. 3:1-4
Gospel: Matt. 28:1-10

Easter Evening (Year A)

Date: Sunday, April 16th, 2017, 19:00
Old Testament: Isa. 25:6-9
Psalms: Ps. 114
New Testament: 1 Cor. 5:6-8
Gospel: Luke 24:13-49

2nd Sunday of Easter (Year A)

Date: Sunday, April 23rd, 2017, 11:00
Old Testament: Acts 2:14,22-32
Psalms: Ps. 16
New Testament: 1 Peter 1:3-9
Gospel: John 20:19-31

3rd Sunday of Easter (Year A)

Date: Sunday, April 30th, 2017, 11:00
Old Testament: Acts 2:14,36-41
Psalms: Ps. 116:1-4,12-19
New Testament: 1 Peter 1:17-23
Gospel: Luke 24:13-35

4th Sunday of Easter (Year A)

Date: Sunday, May 07th, 2017, 11:00
Old Testament: Acts 2:42-47
Psalms: Ps. 23
New Testament: 1 Peter 2:19-25
Gospel: John 10:1-10

5th Sunday of Easter (Year A)

Date: Sunday, May 14th, 2017, 11:00
Old Testament: Acts 7:55-60
Psalms: Ps. 31:1-5,15-16
New Testament: 1 Peter 2:2-10
Gospel: John 14:1-14

6th Sunday of Easter (Year A)

Date: Sunday, May 21st, 2017, 11:00
Old Testament: Acts 17:22-31
Psalms: Ps. 66:8-20
New Testament: 1 Peter 3:13-22
Gospel: John 14:15-21

Ascension of the Lord (Year A)

Date: Thursday, May 25th, 2017, 11:00
Old Testament: Acts 1:1-11
Psalms: Ps. 93
New Testament: Eph. 1:15-23
Gospel: Luke 24:44-53

7th Sunday of Easter (Year A)

Date: Sunday, May 28th, 2017, 11:00
Old Testament: Acts 1:6-14
Psalms: Ps. 68:1-10,32-35
New Testament: 1 Peter 4:12-14;5:6-11
Gospel: John 17:1-11

Day of Pentecost (Year A)

Date: Sunday, June 04th, 2017, 11:00
Old Testament: Num. 11:24-30
Psalms: Ps. 104:24-34,35
New Testament: 1 Cor. 12:3-13
Gospel: John 20:19-23

Trinity Sunday (Year A)

Date: Sunday, June 11th, 2017, 11:00
Old Testament: Gen. 1:1-2:4
Psalms: Ps. 8
New Testament: 2 Cor. 13:11-13
Gospel: Matt. 28:16-20

11th Sunday in Ordinary Time (Year A)

Date: Sunday, June 18th, 2017, 11:00
Old Testament: Gen. 18:1-15;21:1-7
Psalms: Ps. 116:1-2,12-19
New Testament: Rom. 5:1-8
Gospel: Matt. 9:35-10:23

12th Sunday in Ordinary Time (Year A)

Date: Sunday, June 25th, 2017, 11:00
Old Testament: Gen. 21:8-21
Psalms: Ps. 86:1-10,16-17
New Testament: Rom. 6:1-11
Gospel: Matt. 10:24-39

13th Sunday in Ordinary Time (Year A)

Date: Sunday, July 02nd, 2017, 11:00
Old Testament: Gen. 22:1-14
Psalms: Ps. 13
New Testament: Rom. 6:12-23
Gospel: Matt. 10:40-42

14th Sunday in Ordinary Time (Year A)

Date: Sunday, July 09th, 2017, 11:00
Old Testament: Gen. 24:34-38,42-49,58-67
Psalms: Song. 2:8-13
New Testament: Rom. 7:15-25
Gospel: Matt. 11:16-19,25-30

15th Sunday in Ordinary Time (Year A)

Date: Sunday, July 16th, 2017, 11:00
Old Testament: Gen. 25:19-34
Psalms: Ps. 119:105-112
New Testament: Rom. 8:1-11
Gospel: Matt. 13:1-9,18-23

16th Sunday in Ordinary Time (Year A)

Date: Sunday, July 23rd, 2017, 11:00
Old Testament: Gen. 28:10-19
Psalms: Ps. 139:1-12,23-24
New Testament: Rom. 8:12-25
Gospel: Matt. 13:24-30,36-43

17th Sunday in Ordinary Time (Year A)

Date: Sunday, July 30th, 2017, 11:00
Old Testament: Gen. 29:15-28
Psalms: Ps. 105:1-11,45
New Testament: Rom. 8:26-39
Gospel: Matt. 13:31-33,44-52

18th Sunday in Ordinary Time (Year A)

Date: Sunday, August 06th, 2017, 11:00
Old Testament: Gen. 32:22-31
Psalms: Ps. 17:1-7,15
New Testament: Rom. 9:1-5
Gospel: Matt. 14:13-21

19th Sunday in Ordinary Time (Year A)

Date: Sunday, August 13th, 2017, 11:00
Old Testament: Gen. 37:1-4,12-28
Psalms: Ps. 105:1-6,16-22,45
New Testament: Rom. 10:5-15
Gospel: Matt. 14:22-33

20th Sunday in Ordinary Time (Year A)

Date: Sunday, August 20th, 2017, 11:00
Old Testament: Gen. 45:1-15
Psalms: Ps. 133
New Testament: Rom. 11:1-2,29-32
Gospel: Matt. 15:10-28

21st Sunday in Ordinary Time (Year A)

Date: Sunday, August 27th, 2017, 11:00
Old Testament: Ex. 1:8-2:10
Psalms: Ps. 124
New Testament: Rom. 12:1-8
Gospel: Matt. 16:13-20

22nd Sunday in Ordinary Time (Year A)

Date: Sunday, September 03rd, 2017, 11:00
Old Testament: Ex. 3:1-15
Psalms: Ps. 105:1-6,23-26,45
New Testament: Rom. 12:9-21
Gospel: Matt. 16:21-28

23rd Sunday in Ordinary Time (Year A)

Date: Sunday, September 10th, 2017, 11:00
Old Testament: Ex. 12:1-14
Psalms: Ps. 149
New Testament: Rom. 13:8-14
Gospel: Matt. 18:15-20

24th Sunday in Ordinary Time (Year A)

Date: Sunday, September 17th, 2017, 11:00
Old Testament: Ex. 14:19-31
Psalms: Ps. 114
New Testament: Rom. 14:1-12
Gospel: Matt. 18:21-35

25th Sunday in Ordinary Time (Year A)

Date: Sunday, September 24th, 2017, 11:00
Old Testament: Ex. 16:2-15
Psalms: Ps. 105:1-6,37-45
New Testament: Philip. 1:21-30
Gospel: Matt. 20:1-16

26th Sunday in Ordinary Time (Year A)

Date: Sunday, October 01st, 2017, 11:00
Old Testament: Ex. 17:1-7
Psalms: Ps. 78:1-4,12-16
New Testament: Philip. 2:1-13
Gospel: Matt. 21:23-32

27th Sunday in Ordinary Time (Year A)

Date: Sunday, October 08th, 2017, 11:00
Old Testament: Ex. 20:1-4,7-9,12-20
Psalms: Ps. 19
New Testament: Philip. 3:4-14
Gospel: Matt. 21:33-46

28th Sunday in Ordinary Time (Year A)

Date: Sunday, October 15th, 2017, 11:00
Old Testament: Ex. 32:1-14
Psalms: Ps. 106:1-6,19-23
New Testament: Philip. 4:1-9
Gospel: Matt. 22:1-14

29th Sunday in Ordinary Time (Year A)

Date: Sunday, October 22nd, 2017, 11:00
Old Testament: Ex. 33:12-23
Psalms: Ps. 99
New Testament: 1 Thess. 1:1-10
Gospel: Matt. 22:15-22

30th Sunday in Ordinary Time (Year A)

Date: Sunday, October 29th, 2017, 11:00
Old Testament: Deut. 34:1-12
Psalms: Ps. 90:1-6,13-17
New Testament: 1 Thess. 2:1-8
Gospel: Matt. 22:34-46

All Saints' Day (Year A)

Date: Wednesday, November 01st, 2017, 08:00
Old Testament: Rev. 7:9-17
Psalms: Ps. 34:1-10,22
New Testament: 1 John 3:1-3
Gospel: Matt. 5:1-12

31st Sunday in Ordinary Time (Year A)

Date: Sunday, November 05th, 2017, 11:00
Old Testament: Josh. 3:7-17
Psalms: Ps. 107:1-7,33-37
New Testament: 1 Thess. 2:9-13
Gospel: Matt. 23:1-12

32nd Sunday in Ordinary Time (Year A)

Date: Sunday, November 12th, 2017, 11:00
Old Testament: Josh. 24:1-3,14-25
Psalms: Ps. 78:1-7
New Testament: 1 Thess. 4:13-18
Gospel: Matt. 25:1-13

33rd Sunday in Ordinary Time (Year A)

Date: Sunday, November 19th, 2017, 11:00
Old Testament: Judges 4:1-7
Psalms: Ps. 123
New Testament: 1 Thess. 5:1-11
Gospel: Matt. 25:14-30

Christ the King (Year A)

Date: Sunday, November 26th, 2017, 11:00
Old Testament: Ezek. 34:11-16,20-24
Psalms: Ps. 100
New Testament: Eph. 1:15-23
Gospel: Matt. 25:31-46

1st Sunday of Advent (Year B)

Date: Sunday, December 03rd, 2017, 11:00
Old Testament: Isa. 64:1-9
Psalms: Ps. 80:1-7,17-19
New Testament: 1 Cor. 1:3-9
Gospel: Mark 13:24-37

2nd Sunday of Advent (Year B)

Date: Sunday, December 10th, 2017, 11:00
Old Testament: Isa. 40:1-11
Psalms: Ps. 85:1-2,8-13
New Testament: 2 Peter 3:8-15
Gospel: Mark 1:1-8

3rd Sunday of Advent (Year B)

Date: Sunday, December 17th, 2017, 11:00
Old Testament: Isa. 61:1-4,8-11
Psalms: Luke 1:47-55
New Testament: 1 Thess. 5:16-24
Gospel: John 1:6-8,19-28

4th Sunday of Advent (Year B)

Date: Sunday, December 24th, 2017, 11:00
Old Testament: 2 Sam. 7:1-11,16
Psalms: Luke 1:47-55
New Testament: Rom. 16:25-27
Gospel: Luke 1:26-38

Christmas Eve (Year B)

Date: Sunday, December 24th, 2017, 21:00
Old Testament: Isa. 9:2-7
Psalms: Ps. 96
New Testament: Titus 2:11-14
Gospel: Luke 2:1-20

Christmas Day - Dawn (Year B)

Date: Monday, December 25th, 2017, 08:00
Old Testament: Isa. 62:6-12
Psalms: Ps. 97
New Testament: Titus 3:4-7
Gospel: Luke 2:1-20

Christmas Day (Year B)

Date: Monday, December 25th, 2017, 11:00
Old Testament: Isa. 52:7-10
Psalms: Ps. 98
New Testament: Heb. 1:1-12
Gospel: John 1:1-14

1st Sunday after Christmas Day (Year B)

Date: Sunday, December 31st, 2017, 11:00
Old Testament: Isa. 61:10-62:3
Psalms: Ps. 148
New Testament: Gal. 4:4-7
Gospel: Luke 2:22-40

Here is the Lectionary object source code. It may run out to the right a bit.


<?
/*
##################################################
#
# Filename..........: $RCSfile: Lectionary.class,v $
# Original Author...: Anthony L. Awtrey
# Version...........: $Revision: 0.1 $
# Last Modified By..: $Author: aawtrey $
# Last Modified.....: $Date: 2006/09/21 18:15:56 $
#
# Copyright 2006 Anthony Awtrey
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
*/

/*
 * This class uses date calculations to generate the lectionary dates for a
 * given year.
 */
class Lectionary {

  var 
$year;
  var 
$cycle;
  var 
$calendar;
  var 
$lectionary;

  
/*
   * Class initialization
   */
  
function Lectionary($year='') {
    global 
$_SERVER;
    global 
$_SESSION;
    global 
$_REQUEST;
    global 
$_POST;
    global 
$_GET;
    
$this->set_year($year);
  }

  
/*
   * Sets the year or the current year if nothing is passed
   */
  
function set_year($year='') {
    if ( 
$year == '' ) {
      
$this->year gmstrftime("%Y"gmmktime());
    } else {
      
$this->year $year;
    }
    
$this->load_lectionary();
    
$this->generate_calendar();
  }

  
/*
   * Returns the year
   */
  
function get_year() {
    return(
$this->year);
  }

  function 
load_lectionary() {
    if ( 
is_file(constant("RELPATH").'include/lectionary.xml') ) {
      
$this->lectionary simplexml_load_file(constant("RELPATH").'include/lectionary.xml');
      return(
true);
    } else {
      
$this->lectionary false;
      return(
false);
    }
  }

  function 
get_cycle($unixdate) {
    
$y = array('A','B','C','A');
    
$year gmstrftime("%Y"$unixdate);
    
$mod  = ( ($year-1) % );
    if ( 
$unixdate $this->get_advent_sunday() )
    {
      return(
$y[$mod]);
    } else {
      return(
$y[$mod+1]);
    }
  }

  
/*
   * Get the name for a given number
   */
  
function get_number_name($number) {
    
$name = array(
      
1  => 'First',
      
2  => 'Second',
      
3  => 'Third',
      
4  => 'Fourth',
      
5  => 'Fifth',
      
6  => 'Sixth',
      
7  => 'Seventh'
    
);
    return isset(
$name[$number]) ? $name[$number] : '';
  }
  
  
/*
   * Get the english suffix for a given number
   */
  
function get_suffix($dayOfTheMonth) {
    
$suffix = array(
      
1  => 'st',
      
2  => 'nd',
      
3  => 'rd',
      
21 => 'st',
      
22 => 'nd',
      
23 => 'rd',
      
31 => 'st'
    
);
    return isset(
$suffix[$dayOfTheMonth]) ? $suffix[$dayOfTheMonth] : 'th';
  }
  
  
/*
   * Get the long format date for a given unix timestamp
   */
  
function get_long_date($timestamp) {
    
$s $this->get_suffix(intval(gmstrftime("%d",$timestamp)));
    return 
gmstrftime("%A, %B %d<sup>$s</sup>, %Y, %H:%M"$timestamp );
    
//return gmstrftime("%A, %B %d$s, %Y", $timestamp );
  
}
  
  
/*
   * Get the timestamp for the first sunday of the year
   */
  
function get_first_sunday() {
    
$dow  intval(gmstrftime("%w"gmmktime(11,0,0,1,1,$this->year)));
    if ( 
$dow == ) { $dow 7; }
    
$delta $dow;
    return 
intval(gmmktime(11,0,0,1,1+$delta,$this->year));
  }

  
/*
   * Get the timestamp for the first sunday after Epiphany (Jan 6)
   */
  
function get_sunday_after_epiphany() {
    
$dow  intval(gmstrftime("%w"gmmktime(11,0,0,1,6,$this->year)));
    if ( 
$dow == ) {
      
$delta 7;
    } else {
      
$delta $dow;
    }
    return 
intval(gmmktime(11,0,0,1,6+$delta,$this->year));
  }

  
/*
   * Get the timestamp for easter in a given year
   */
  
function getEasterSunday() {
    return 
intval(gmmktime(11,0,0,3,21+easter_days($this->year),$this->year));
  }
  
  
/*
   * Get the timestamp for the first Sunday in advent
   */
  
function get_advent_sunday() {
    
$dow  intval(gmstrftime("%w"gmmktime(11,0,0,12,25,$this->year)));
    if ( 
$dow == ) { $dow 7; }
    
$delta = -28 + ( $dow );
    return 
intval(gmmktime(11,0,0,12,25+$delta,$this->year));
  }

  
/*
   * Calculate all the calendar dates
   */
  
function generate_calendar() {
    
$day  86400# Number of seconds in a day

    ##
    ## These are the fixed days in the year
    ##

    
if ( $this->get_first_sunday() == gmmktime(11,0,0,1,1,$this->year) ) {
      
$this->calendar[$this->get_first_sunday()]            = '8'# First Sunday after Christmas Day
    
} else {
      
$this->calendar[$this->get_first_sunday()]            = '9'# Second Sunday after Christmas Day
    
}
    
$this->calendar[gmmktime(110016$this->year)]  = '10'# Epiphany of the Lord
    
$this->calendar[$this->get_sunday_after_epiphany()]     = '11'# Baptism of the Lord
    
$this->calendar[$this->getEasterSunday()-(49*$day)]     = '12'# Transfiguration Sunday
    
$this->calendar[$this->getEasterSunday()-(46*$day)]     = '13'# Ash Wednesday
    
$this->calendar[$this->getEasterSunday()-(42*$day)]     = '14'# First Sunday in Lent
    
$this->calendar[$this->getEasterSunday()-(35*$day)]     = '15'# Second Sunday in Lent
    
$this->calendar[$this->getEasterSunday()-(28*$day)]     = '16'# Third Sunday in Lent
    
$this->calendar[$this->getEasterSunday()-(21*$day)]     = '17'# Fourth Sunday in Lent
    
$this->calendar[$this->getEasterSunday()-(14*$day)]     = '18'# Fifth Sunday in Lent
    
$this->calendar[$this->getEasterSunday()-(7*$day)]      = '19'# Palm/Passion Sunday
    
$this->calendar[$this->getEasterSunday()-(6*$day)]      = '20'# Monday of Holy Week
    
$this->calendar[$this->getEasterSunday()-(5*$day)]      = '21'# Tuesday of Holy Week
    
$this->calendar[$this->getEasterSunday()-(4*$day)]      = '22'# Wednesday of Holy Week
    
$this->calendar[$this->getEasterSunday()-(3*$day)]      = '23'# Maundy Thursday
    
$this->calendar[$this->getEasterSunday()-(2*$day)]      = '24'# Good Friday
    
$this->calendar[$this->getEasterSunday()-(1*$day)]      = '25'# Holy Saturday
    
$this->calendar[$this->getEasterSunday()]               = '26'# Easter Sunday
    
$this->calendar[$this->getEasterSunday()+(8*60*60)]     = '27'# Easter Evening
    
$this->calendar[$this->getEasterSunday()+(7*$day)]      = '28'# Second Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(14*$day)]     = '29'# Third Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(21*$day)]     = '30'# Fourth Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(28*$day)]     = '31'# Fifth Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(35*$day)]     = '32'# Sixth Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(39*$day)]     = '33'# Ascension Sunday
    
$this->calendar[$this->getEasterSunday()+(42*$day)]     = '34'# Seventh Sunday of Easter
    
$this->calendar[$this->getEasterSunday()+(49*$day)]     = '35'# Day of Pentecost
    
$this->calendar[$this->getEasterSunday()+(56*$day)]     = '36'# Trinity Sunday
    
$this->calendar[gmmktime(800111$this->year)]  = '37'# All Saint's Day
    
$this->calendar[$this->get_advent_sunday()-(7*$day)]    = '38'# Christ the King Sunday
    
$this->calendar[$this->get_advent_sunday()]             = '1';  # First Sunday in Advent
    
$this->calendar[$this->get_advent_sunday()+(7*$day)]    = '2';  # Second Sunday in Advent
    
$this->calendar[$this->get_advent_sunday()+(14*$day)]   = '3';  # Third Sunday in Advent
    
$this->calendar[$this->get_advent_sunday()+(21*$day)]   = '4';  # Fourth Sunday in Advent
    
$this->calendar[gmmktime(21001224$this->year)] = '5'# Christmas Eve
    
$this->calendar[gmmktime(8001225$this->year)]  = '6'# Christmas Day (Sunrise)
    
$this->calendar[gmmktime(11001225$this->year)] = '7'# Christmas Day
    
if ( != intval(gmstrftime("%w"gmmktime(11,0,0,12,25,$this->year))) ) {
      
$this->calendar[$this->get_advent_sunday()+(28*$day)] = '8';  # First Sunday after Christmas Day
    
}

    
##
    ## These are the variable days in the year
    ##

    # Variable Sundays after Epiphany counting forward from 2nd Sunday in Ordinary Time
    
$index=39;
    for ( 
$i=$this->get_sunday_after_epiphany()+(7*$day); $i<$this->getEasterSunday()-(49*$day); $i=$i+(7*$day) ) {
      if ( 
$this->calendar[$i] == '' ) {
        
$this->calendar[$i] = $index# Sunday's after Epiphany
        
$index++;
      }
    }

    
# Variable Sundays after Pentecost counting backwards from 33rd sunday in Ordinary Time
    
$index=70;
    for ( 
$i=$this->get_advent_sunday()-(14*$day); $i>$this->getEasterSunday()+(56*$day); $i=$i-(7*$day) ) {
      if ( 
$this->calendar[$i] == '' ) {
        
$this->calendar[$i] = $index# Sunday's after Pentecost
        
$index--;
      }
    }

    
ksort($this->calendar);
  }

  
/*
   * Get the calendar array
   */
  
function get_calendar()
  {
    return(
$this->calendar);
  }

  function 
get_calendar_day($unixdate)
  {
    
$year      gmstrftime('%Y',$unixdate);
    
$month     gmstrftime('%m',$unixdate);
    
$day       gmstrftime('%d',$unixdate);
    
$day_start gmmktime(0,0,0,$month,$day,$year);
    
$day_end   gmmktime(23,59,59,$month,$day,$year);
    
$result    = array();
    foreach ( 
$this->calendar as $key => $val) {
      if ( 
$key >= $day_start && $key <= $day_end ) {
        
$result[$key] = $val;
      }
    }
    return(
$result);
  }

  function 
get_title($unixdate,$index) {
    
$result '';
    
$xpath   "//lectionary/year[@name='".$this->get_cycle($unixdate)."']/day[@name='".$index."']/title";
    foreach ( 
$this->lectionary->xpath($xpath) as $text) {
      
$result .= "$text";
    }
    return(
$result);
  }

  function 
get_scripture($unixdate,$index,$lesson) {
    
$result '';
    
$xpath   "//lectionary/year[@name='".$this->get_cycle($unixdate)."']/day[@name='".$index."']/scripture/$lesson";
    foreach ( 
$this->lectionary->xpath($xpath) as $text) {
      
$result .= "$text";
    }
    return(
$result);
  }

}

?>