| @@ 25-34 (lines=10) @@ | ||
| 22 | */ | |
| 23 | protected $buffer; | |
| 24 | ||
| 25 | 	public function __construct( $item_limit, $byte_limit, $time = '1970-01-01 00:00:00' ) { | |
| 26 | $this->is_full_flag = false; | |
| 27 | $this->is_empty_flag = true; | |
| 28 | $this->timestamp = $time; | |
| 29 | ||
| 30 | $this->finder = new Jetpack_Sitemap_Finder(); | |
| 31 | ||
| 32 | $this->item_capacity = max( 1, intval( $item_limit ) ); | |
| 33 | $this->byte_capacity = max( 1, intval( $byte_limit ) ) - strlen( $this->contents() ); | |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Append an item to the buffer, if there is room for it, | |
| @@ 109-118 (lines=10) @@ | ||
| 106 | * @param int $byte_limit The maximum size of the buffer in bytes. | |
| 107 | * @param string $time The initial datetime of the buffer. Must be in 'YYYY-MM-DD hh:mm:ss' format. | |
| 108 | */ | |
| 109 | 	public function __construct( $item_limit, $byte_limit, $time ) { | |
| 110 | $this->is_full_flag = false; | |
| 111 | $this->timestamp = $time; | |
| 112 | ||
| 113 | $this->finder = new Jetpack_Sitemap_Finder(); | |
| 114 | $this->doc = new DOMDocument( '1.0', 'UTF-8' ); | |
| 115 | ||
| 116 | $this->item_capacity = max( 1, intval( $item_limit ) ); | |
| 117 | $this->byte_capacity = max( 1, intval( $byte_limit ) ) - strlen( $this->doc->saveXML() ); | |
| 118 | } | |
| 119 | ||
| 120 | /** | |
| 121 | * Returns a DOM element that contains all sitemap elements. | |