@@ -197,43 +197,43 @@ discard block |
||
197 | 197 | */ |
198 | 198 | class FeedItem extends HtmlDescribable |
199 | 199 | { |
200 | - /** |
|
201 | - * Mandatory attributes of an item. |
|
202 | - */ |
|
203 | - public $title, $description, $link; |
|
204 | - |
|
205 | - /** |
|
206 | - * Optional attributes of an item. |
|
207 | - */ |
|
208 | - public $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator; |
|
209 | - |
|
210 | - /** |
|
211 | - * Publishing date of an item. May be in one of the following formats: |
|
212 | - * |
|
213 | - * RFC 822: |
|
214 | - * "Mon, 20 Jan 03 18:05:41 +0400" |
|
215 | - * "20 Jan 03 18:05:41 +0000" |
|
216 | - * |
|
217 | - * ISO 8601: |
|
218 | - * "2003-01-20T18:05:41+04:00" |
|
219 | - * |
|
220 | - * Unix: |
|
221 | - * 1043082341 |
|
222 | - */ |
|
223 | - public $date; |
|
224 | - |
|
225 | - /** |
|
226 | - * Any additional elements to include as an assiciated array. All $key => $value pairs |
|
227 | - * will be included unencoded in the feed item in the form |
|
228 | - * <$key>$value</$key> |
|
229 | - * Again: No encoding will be used! This means you can invalidate or enhance the feed |
|
230 | - * if $value contains markup. This may be abused to embed tags not implemented by |
|
231 | - * the FeedCreator class used. |
|
232 | - */ |
|
233 | - public $additionalElements = array(); |
|
234 | - |
|
235 | - // on hold |
|
236 | - // var $source; |
|
200 | + /** |
|
201 | + * Mandatory attributes of an item. |
|
202 | + */ |
|
203 | + public $title, $description, $link; |
|
204 | + |
|
205 | + /** |
|
206 | + * Optional attributes of an item. |
|
207 | + */ |
|
208 | + public $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator; |
|
209 | + |
|
210 | + /** |
|
211 | + * Publishing date of an item. May be in one of the following formats: |
|
212 | + * |
|
213 | + * RFC 822: |
|
214 | + * "Mon, 20 Jan 03 18:05:41 +0400" |
|
215 | + * "20 Jan 03 18:05:41 +0000" |
|
216 | + * |
|
217 | + * ISO 8601: |
|
218 | + * "2003-01-20T18:05:41+04:00" |
|
219 | + * |
|
220 | + * Unix: |
|
221 | + * 1043082341 |
|
222 | + */ |
|
223 | + public $date; |
|
224 | + |
|
225 | + /** |
|
226 | + * Any additional elements to include as an assiciated array. All $key => $value pairs |
|
227 | + * will be included unencoded in the feed item in the form |
|
228 | + * <$key>$value</$key> |
|
229 | + * Again: No encoding will be used! This means you can invalidate or enhance the feed |
|
230 | + * if $value contains markup. This may be abused to embed tags not implemented by |
|
231 | + * the FeedCreator class used. |
|
232 | + */ |
|
233 | + public $additionalElements = array(); |
|
234 | + |
|
235 | + // on hold |
|
236 | + // var $source; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | */ |
244 | 244 | class FeedImage extends HtmlDescribable |
245 | 245 | { |
246 | - /** |
|
247 | - * Mandatory attributes of an image. |
|
248 | - */ |
|
249 | - public $title, $url, $link; |
|
250 | - |
|
251 | - /** |
|
252 | - * Optional attributes of an image. |
|
253 | - */ |
|
254 | - public $width, $height, $description; |
|
246 | + /** |
|
247 | + * Mandatory attributes of an image. |
|
248 | + */ |
|
249 | + public $title, $url, $link; |
|
250 | + |
|
251 | + /** |
|
252 | + * Optional attributes of an image. |
|
253 | + */ |
|
254 | + public $width, $height, $description; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -260,28 +260,28 @@ discard block |
||
260 | 260 | */ |
261 | 261 | class HtmlDescribable |
262 | 262 | { |
263 | - /** |
|
264 | - * Indicates whether the description field should be rendered in HTML. |
|
265 | - */ |
|
266 | - public $descriptionHtmlSyndicated; |
|
267 | - |
|
268 | - /** |
|
269 | - * Indicates whether and to how many characters a description should be truncated. |
|
270 | - */ |
|
271 | - public $descriptionTruncSize; |
|
272 | - |
|
273 | - /** |
|
274 | - * Returns a formatted description field, depending on descriptionHtmlSyndicated and |
|
275 | - * $descriptionTruncSize properties |
|
276 | - * @return string the formatted description |
|
277 | - */ |
|
278 | - public function getDescription() { |
|
279 | - $descriptionField = new FeedHtmlField($this->description); |
|
280 | - $descriptionField->syndicateHtml = $this->descriptionHtmlSyndicated; |
|
281 | - $descriptionField->truncSize = $this->descriptionTruncSize; |
|
282 | - |
|
283 | - return $descriptionField->output(); |
|
284 | - } |
|
263 | + /** |
|
264 | + * Indicates whether the description field should be rendered in HTML. |
|
265 | + */ |
|
266 | + public $descriptionHtmlSyndicated; |
|
267 | + |
|
268 | + /** |
|
269 | + * Indicates whether and to how many characters a description should be truncated. |
|
270 | + */ |
|
271 | + public $descriptionTruncSize; |
|
272 | + |
|
273 | + /** |
|
274 | + * Returns a formatted description field, depending on descriptionHtmlSyndicated and |
|
275 | + * $descriptionTruncSize properties |
|
276 | + * @return string the formatted description |
|
277 | + */ |
|
278 | + public function getDescription() { |
|
279 | + $descriptionField = new FeedHtmlField($this->description); |
|
280 | + $descriptionField->syndicateHtml = $this->descriptionHtmlSyndicated; |
|
281 | + $descriptionField->truncSize = $this->descriptionTruncSize; |
|
282 | + |
|
283 | + return $descriptionField->output(); |
|
284 | + } |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -292,50 +292,50 @@ discard block |
||
292 | 292 | */ |
293 | 293 | class FeedHtmlField |
294 | 294 | { |
295 | - /** |
|
296 | - * Mandatory attributes of a FeedHtmlField. |
|
297 | - */ |
|
298 | - public $rawFieldContent; |
|
299 | - |
|
300 | - /** |
|
301 | - * Optional attributes of a FeedHtmlField. |
|
302 | - * |
|
303 | - */ |
|
304 | - public $truncSize, $syndicateHtml; |
|
305 | - |
|
306 | - /** |
|
307 | - * Creates a new instance of FeedHtmlField. |
|
308 | - * @param $parFieldContent |
|
309 | - * @internal param $string : if given, sets the rawFieldContent property |
|
310 | - */ |
|
311 | - public function __construct($parFieldContent) { |
|
312 | - if ($parFieldContent) { |
|
313 | - $this->rawFieldContent = $parFieldContent; |
|
314 | - } |
|
315 | - } |
|
316 | - |
|
317 | - /** |
|
318 | - * Creates the right output, depending on $truncSize, $syndicateHtml properties. |
|
319 | - * @return string the formatted field |
|
320 | - */ |
|
321 | - public function output() { |
|
322 | - // when field available and syndicated in html we assume |
|
323 | - // - valid html in $rawFieldContent and we enclose in CDATA tags |
|
324 | - // - no truncation (truncating risks producing invalid html) |
|
325 | - if (!$this->rawFieldContent) { |
|
326 | - $result = ''; |
|
327 | - } elseif ($this->syndicateHtml) { |
|
328 | - $result = '<![CDATA[' . $this->rawFieldContent . ']]>'; |
|
329 | - } else { |
|
330 | - if ($this->truncSize && is_int($this->truncSize)) { |
|
331 | - $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent), $this->truncSize); |
|
332 | - } else { |
|
333 | - $result = htmlspecialchars($this->rawFieldContent); |
|
334 | - } |
|
335 | - } |
|
336 | - |
|
337 | - return $result; |
|
338 | - } |
|
295 | + /** |
|
296 | + * Mandatory attributes of a FeedHtmlField. |
|
297 | + */ |
|
298 | + public $rawFieldContent; |
|
299 | + |
|
300 | + /** |
|
301 | + * Optional attributes of a FeedHtmlField. |
|
302 | + * |
|
303 | + */ |
|
304 | + public $truncSize, $syndicateHtml; |
|
305 | + |
|
306 | + /** |
|
307 | + * Creates a new instance of FeedHtmlField. |
|
308 | + * @param $parFieldContent |
|
309 | + * @internal param $string : if given, sets the rawFieldContent property |
|
310 | + */ |
|
311 | + public function __construct($parFieldContent) { |
|
312 | + if ($parFieldContent) { |
|
313 | + $this->rawFieldContent = $parFieldContent; |
|
314 | + } |
|
315 | + } |
|
316 | + |
|
317 | + /** |
|
318 | + * Creates the right output, depending on $truncSize, $syndicateHtml properties. |
|
319 | + * @return string the formatted field |
|
320 | + */ |
|
321 | + public function output() { |
|
322 | + // when field available and syndicated in html we assume |
|
323 | + // - valid html in $rawFieldContent and we enclose in CDATA tags |
|
324 | + // - no truncation (truncating risks producing invalid html) |
|
325 | + if (!$this->rawFieldContent) { |
|
326 | + $result = ''; |
|
327 | + } elseif ($this->syndicateHtml) { |
|
328 | + $result = '<![CDATA[' . $this->rawFieldContent . ']]>'; |
|
329 | + } else { |
|
330 | + if ($this->truncSize && is_int($this->truncSize)) { |
|
331 | + $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent), $this->truncSize); |
|
332 | + } else { |
|
333 | + $result = htmlspecialchars($this->rawFieldContent); |
|
334 | + } |
|
335 | + } |
|
336 | + |
|
337 | + return $result; |
|
338 | + } |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -349,125 +349,125 @@ discard block |
||
349 | 349 | */ |
350 | 350 | class UniversalFeedCreator extends FeedCreator |
351 | 351 | { |
352 | - public $_feed; |
|
353 | - |
|
354 | - /** |
|
355 | - * @param $format |
|
356 | - */ |
|
357 | - public function _setFormat($format) { |
|
358 | - switch (strtoupper($format)) { |
|
359 | - |
|
360 | - case '2.0': |
|
361 | - // fall through |
|
362 | - case 'RSS2.0': |
|
363 | - $this->_feed = new RSSCreator20(); |
|
364 | - break; |
|
365 | - |
|
366 | - case '1.0': |
|
367 | - // fall through |
|
368 | - case 'RSS1.0': |
|
369 | - $this->_feed = new RSSCreator10(); |
|
370 | - break; |
|
371 | - |
|
372 | - case '0.91': |
|
373 | - // fall through |
|
374 | - case 'RSS0.91': |
|
375 | - $this->_feed = new RSSCreator091(); |
|
376 | - break; |
|
377 | - |
|
378 | - case 'PIE0.1': |
|
379 | - $this->_feed = new PIECreator01(); |
|
380 | - break; |
|
381 | - |
|
382 | - case 'MBOX': |
|
383 | - $this->_feed = new MBOXCreator(); |
|
384 | - break; |
|
385 | - |
|
386 | - case 'OPML': |
|
387 | - $this->_feed = new OPMLCreator(); |
|
388 | - break; |
|
389 | - |
|
390 | - case 'ATOM': |
|
391 | - // fall through: always the latest ATOM version |
|
392 | - |
|
393 | - case 'ATOM0.3': |
|
394 | - $this->_feed = new AtomCreator03(); |
|
395 | - break; |
|
396 | - |
|
397 | - case 'HTML': |
|
398 | - $this->_feed = new HTMLCreator(); |
|
399 | - break; |
|
400 | - |
|
401 | - case 'JS': |
|
402 | - // fall through |
|
403 | - case 'JAVASCRIPT': |
|
404 | - $this->_feed = new JSCreator(); |
|
405 | - break; |
|
406 | - |
|
407 | - default: |
|
408 | - $this->_feed = new RSSCreator091(); |
|
409 | - break; |
|
410 | - } |
|
411 | - |
|
412 | - $vars = get_object_vars($this); |
|
413 | - foreach ($vars as $key => $value) { |
|
414 | - // prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself |
|
415 | - //if (!in_array($key, array("_feed", "contentType", "encoding"))) { |
|
416 | - $this->_feed->{$key} = $this->{$key}; |
|
417 | - //} |
|
418 | - } |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * Creates a syndication feed based on the items previously added. |
|
423 | - * |
|
424 | - * @see FeedCreator::addItem() |
|
425 | - * @param string format format the feed should comply to. Valid values are: |
|
426 | - * "PIE0.1", "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3", "HTML", "JS" |
|
427 | - * @return string the contents of the feed. |
|
428 | - */ |
|
429 | - public function createFeed($format = 'RSS0.91') { |
|
430 | - $this->_setFormat($format); |
|
431 | - |
|
432 | - return $this->_feed->createFeed(); |
|
433 | - } |
|
434 | - |
|
435 | - /** |
|
436 | - * Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect |
|
437 | - * header may be sent to redirect the use to the newly created file. |
|
438 | - * @since 1.4 |
|
439 | - * |
|
440 | - * @param string $format |
|
441 | - * @param string $filename |
|
442 | - * @param bool $displayContents displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response. |
|
443 | - * @internal param format $string format the feed should comply to. Valid values are: |
|
444 | - * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM", "ATOM0.3", "HTML", "JS" |
|
445 | - * @internal param filename $string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
446 | - */ |
|
447 | - public function saveFeed($format = 'RSS0.91', $filename = '', $displayContents = true) { |
|
448 | - $this->_setFormat($format); |
|
449 | - $this->_feed->saveFeed($filename, $displayContents); |
|
450 | - } |
|
451 | - |
|
452 | - /** |
|
453 | - * Turns on caching and checks if there is a recent version of this feed in the cache. |
|
454 | - * If there is, an HTTP redirect header is sent. |
|
455 | - * To effectively use caching, you should create the FeedCreator object and call this method |
|
456 | - * before anything else, especially before you do the time consuming task to build the feed |
|
457 | - * (web fetching, for example). |
|
458 | - * |
|
459 | - * @param string $format |
|
460 | - * @param string $filename |
|
461 | - * @param int $timeout |
|
462 | - * @internal param format $string format the feed should comply to. Valid values are: |
|
463 | - * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". |
|
464 | - * @internal param string $filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
465 | - * @internal param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) |
|
466 | - */ |
|
467 | - public function useCached($format = 'RSS0.91', $filename = '', $timeout = 3600) { |
|
468 | - $this->_setFormat($format); |
|
469 | - $this->_feed->useCached($filename, $timeout); |
|
470 | - } |
|
352 | + public $_feed; |
|
353 | + |
|
354 | + /** |
|
355 | + * @param $format |
|
356 | + */ |
|
357 | + public function _setFormat($format) { |
|
358 | + switch (strtoupper($format)) { |
|
359 | + |
|
360 | + case '2.0': |
|
361 | + // fall through |
|
362 | + case 'RSS2.0': |
|
363 | + $this->_feed = new RSSCreator20(); |
|
364 | + break; |
|
365 | + |
|
366 | + case '1.0': |
|
367 | + // fall through |
|
368 | + case 'RSS1.0': |
|
369 | + $this->_feed = new RSSCreator10(); |
|
370 | + break; |
|
371 | + |
|
372 | + case '0.91': |
|
373 | + // fall through |
|
374 | + case 'RSS0.91': |
|
375 | + $this->_feed = new RSSCreator091(); |
|
376 | + break; |
|
377 | + |
|
378 | + case 'PIE0.1': |
|
379 | + $this->_feed = new PIECreator01(); |
|
380 | + break; |
|
381 | + |
|
382 | + case 'MBOX': |
|
383 | + $this->_feed = new MBOXCreator(); |
|
384 | + break; |
|
385 | + |
|
386 | + case 'OPML': |
|
387 | + $this->_feed = new OPMLCreator(); |
|
388 | + break; |
|
389 | + |
|
390 | + case 'ATOM': |
|
391 | + // fall through: always the latest ATOM version |
|
392 | + |
|
393 | + case 'ATOM0.3': |
|
394 | + $this->_feed = new AtomCreator03(); |
|
395 | + break; |
|
396 | + |
|
397 | + case 'HTML': |
|
398 | + $this->_feed = new HTMLCreator(); |
|
399 | + break; |
|
400 | + |
|
401 | + case 'JS': |
|
402 | + // fall through |
|
403 | + case 'JAVASCRIPT': |
|
404 | + $this->_feed = new JSCreator(); |
|
405 | + break; |
|
406 | + |
|
407 | + default: |
|
408 | + $this->_feed = new RSSCreator091(); |
|
409 | + break; |
|
410 | + } |
|
411 | + |
|
412 | + $vars = get_object_vars($this); |
|
413 | + foreach ($vars as $key => $value) { |
|
414 | + // prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself |
|
415 | + //if (!in_array($key, array("_feed", "contentType", "encoding"))) { |
|
416 | + $this->_feed->{$key} = $this->{$key}; |
|
417 | + //} |
|
418 | + } |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * Creates a syndication feed based on the items previously added. |
|
423 | + * |
|
424 | + * @see FeedCreator::addItem() |
|
425 | + * @param string format format the feed should comply to. Valid values are: |
|
426 | + * "PIE0.1", "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3", "HTML", "JS" |
|
427 | + * @return string the contents of the feed. |
|
428 | + */ |
|
429 | + public function createFeed($format = 'RSS0.91') { |
|
430 | + $this->_setFormat($format); |
|
431 | + |
|
432 | + return $this->_feed->createFeed(); |
|
433 | + } |
|
434 | + |
|
435 | + /** |
|
436 | + * Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect |
|
437 | + * header may be sent to redirect the use to the newly created file. |
|
438 | + * @since 1.4 |
|
439 | + * |
|
440 | + * @param string $format |
|
441 | + * @param string $filename |
|
442 | + * @param bool $displayContents displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response. |
|
443 | + * @internal param format $string format the feed should comply to. Valid values are: |
|
444 | + * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM", "ATOM0.3", "HTML", "JS" |
|
445 | + * @internal param filename $string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
446 | + */ |
|
447 | + public function saveFeed($format = 'RSS0.91', $filename = '', $displayContents = true) { |
|
448 | + $this->_setFormat($format); |
|
449 | + $this->_feed->saveFeed($filename, $displayContents); |
|
450 | + } |
|
451 | + |
|
452 | + /** |
|
453 | + * Turns on caching and checks if there is a recent version of this feed in the cache. |
|
454 | + * If there is, an HTTP redirect header is sent. |
|
455 | + * To effectively use caching, you should create the FeedCreator object and call this method |
|
456 | + * before anything else, especially before you do the time consuming task to build the feed |
|
457 | + * (web fetching, for example). |
|
458 | + * |
|
459 | + * @param string $format |
|
460 | + * @param string $filename |
|
461 | + * @param int $timeout |
|
462 | + * @internal param format $string format the feed should comply to. Valid values are: |
|
463 | + * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". |
|
464 | + * @internal param string $filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
465 | + * @internal param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) |
|
466 | + */ |
|
467 | + public function useCached($format = 'RSS0.91', $filename = '', $timeout = 3600) { |
|
468 | + $this->_setFormat($format); |
|
469 | + $this->_feed->useCached($filename, $timeout); |
|
470 | + } |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -480,246 +480,246 @@ discard block |
||
480 | 480 | */ |
481 | 481 | class FeedCreator extends HtmlDescribable |
482 | 482 | { |
483 | - /** |
|
484 | - * Mandatory attributes of a feed. |
|
485 | - */ |
|
486 | - public $title, $description, $link; |
|
487 | - |
|
488 | - /** |
|
489 | - * Optional attributes of a feed. |
|
490 | - */ |
|
491 | - public $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays; |
|
492 | - |
|
493 | - /** |
|
494 | - * The url of the external xsl stylesheet used to format the naked rss feed. |
|
495 | - * Ignored in the output when empty. |
|
496 | - */ |
|
497 | - public $xslStyleSheet = ''; |
|
498 | - |
|
499 | - public $cssStyleSheet = ''; |
|
500 | - |
|
501 | - /** |
|
502 | - * @access private |
|
503 | - */ |
|
504 | - public $items = array(); |
|
505 | - |
|
506 | - /** |
|
507 | - * This feed's MIME content type. |
|
508 | - * @since 1.4 |
|
509 | - * @access private |
|
510 | - */ |
|
511 | - public $contentType = 'application/xml'; |
|
512 | - |
|
513 | - /** |
|
514 | - * This feed's character encoding. |
|
515 | - * @since 1.6.1 |
|
516 | - **/ |
|
517 | - public $encoding = 'ISO-8859-1'; |
|
518 | - |
|
519 | - /** |
|
520 | - * Any additional elements to include as an assiciated array. All $key => $value pairs |
|
521 | - * will be included unencoded in the feed in the form |
|
522 | - * <$key>$value</$key> |
|
523 | - * Again: No encoding will be used! This means you can invalidate or enhance the feed |
|
524 | - * if $value contains markup. This may be abused to embed tags not implemented by |
|
525 | - * the FeedCreator class used. |
|
526 | - */ |
|
527 | - public $additionalElements = array(); |
|
528 | - |
|
529 | - /** |
|
530 | - * Adds an FeedItem to the feed. |
|
531 | - * |
|
532 | - * @param $item |
|
533 | - * @internal param FeedItem $object $item The FeedItem to add to the feed. |
|
534 | - * @access public |
|
535 | - */ |
|
536 | - public function addItem($item) { |
|
537 | - $this->items[] = $item; |
|
538 | - } |
|
539 | - |
|
540 | - /** |
|
541 | - * Truncates a string to a certain length at the most sensible point. |
|
542 | - * First, if there's a '.' character near the end of the string, the string is truncated after this character. |
|
543 | - * If there is no '.', the string is truncated after the last ' ' character. |
|
544 | - * If the string is truncated, " ..." is appended. |
|
545 | - * If the string is already shorter than $length, it is returned unchanged. |
|
546 | - * |
|
547 | - * @static |
|
548 | - * @param string string A string to be truncated. |
|
549 | - * @param int length the maximum length the string should be truncated to |
|
550 | - * @return string the truncated string |
|
551 | - */ |
|
552 | - public function iTrunc($string, $length) { |
|
553 | - if (strlen($string) <= $length) { |
|
554 | - return $string; |
|
555 | - } |
|
556 | - |
|
557 | - $pos = strrpos($string, '.'); |
|
558 | - if ($pos >= $length - 4) { |
|
559 | - $string = substr($string, 0, $length - 4); |
|
560 | - $pos = strrpos($string, '.'); |
|
561 | - } |
|
562 | - if ($pos >= $length * 0.4) { |
|
563 | - return substr($string, 0, $pos + 1) . ' ...'; |
|
564 | - } |
|
565 | - |
|
566 | - $pos = strrpos($string, ' '); |
|
567 | - if ($pos >= $length - 4) { |
|
568 | - $string = substr($string, 0, $length - 4); |
|
569 | - $pos = strrpos($string, ' '); |
|
570 | - } |
|
571 | - if ($pos >= $length * 0.4) { |
|
572 | - return substr($string, 0, $pos) . ' ...'; |
|
573 | - } |
|
574 | - |
|
575 | - return substr($string, 0, $length - 4) . ' ...'; |
|
576 | - } |
|
577 | - |
|
578 | - /** |
|
579 | - * Creates a comment indicating the generator of this feed. |
|
580 | - * The format of this comment seems to be recognized by |
|
581 | - * Syndic8.com. |
|
582 | - */ |
|
583 | - public function _createGeneratorComment() { |
|
584 | - return "<!-- generator=\"" . FEEDCREATOR_VERSION . "\" -->\n"; |
|
585 | - } |
|
586 | - |
|
587 | - /** |
|
588 | - * Creates a string containing all additional elements specified in |
|
589 | - * $additionalElements. |
|
590 | - * @param array $elements |
|
591 | - * @param string $indentString |
|
592 | - * @return string the XML tags corresponding to $additionalElements |
|
593 | - * @internal param array $elements an associative array containing key => value pairs |
|
594 | - * @internal param string $indentString a string that will be inserted before every generated line |
|
595 | - */ |
|
596 | - public function _createAdditionalElements($elements, $indentString = '') { |
|
597 | - $ae = ''; |
|
598 | - if (is_array($elements)) { |
|
599 | - foreach ($elements as $key => $value) { |
|
600 | - $ae .= $indentString . "<$key>$value</$key>\n"; |
|
601 | - } |
|
602 | - } |
|
603 | - |
|
604 | - return $ae; |
|
605 | - } |
|
606 | - |
|
607 | - /** |
|
608 | - * @return string |
|
609 | - */ |
|
610 | - public function _createStylesheetReferences() { |
|
611 | - $xml = ''; |
|
612 | - if ($this->cssStyleSheet) { |
|
613 | - $xml .= "<?xml-stylesheet href=\"" . $this->cssStyleSheet . "\" type=\"text/css\"?>\n"; |
|
614 | - } |
|
615 | - if ($this->xslStyleSheet) { |
|
616 | - $xml .= "<?xml-stylesheet href=\"" . $this->xslStyleSheet . "\" type=\"text/xsl\"?>\n"; |
|
617 | - } |
|
618 | - |
|
619 | - return $xml; |
|
620 | - } |
|
621 | - |
|
622 | - /** |
|
623 | - * Builds the feed's text. |
|
624 | - * @abstract |
|
625 | - * @return string the feed's complete text |
|
626 | - */ |
|
627 | - public function createFeed() { |
|
628 | - } |
|
629 | - |
|
630 | - /** |
|
631 | - * Generate a filename for the feed cache file. The result will be $_SERVER["PHP_SELF"] with the extension changed to .xml. |
|
632 | - * For example: |
|
633 | - * |
|
634 | - * echo $_SERVER["PHP_SELF"]."\n"; |
|
635 | - * echo FeedCreator::_generateFilename(); |
|
636 | - * |
|
637 | - * would produce: |
|
638 | - * |
|
639 | - * /rss/latestnews.php |
|
640 | - * latestnews.xml |
|
641 | - * |
|
642 | - * @return string the feed cache filename |
|
643 | - * @since 1.4 |
|
644 | - * @access private |
|
645 | - */ |
|
646 | - public function _generateFilename() { |
|
647 | - $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
648 | - |
|
649 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.xml'; |
|
650 | - } |
|
651 | - |
|
652 | - /** |
|
653 | - * @since 1.4 |
|
654 | - * @access private |
|
655 | - * @param $filename |
|
656 | - */ |
|
657 | - public function _redirect($filename) { |
|
658 | - // attention, heavily-commented-out-area |
|
659 | - |
|
660 | - // maybe use this in addition to file time checking |
|
661 | - //Header("Expires: ".date("r",time()+$this->_timeout)); |
|
662 | - |
|
663 | - /* no caching at all, doesn't seem to work as good: |
|
483 | + /** |
|
484 | + * Mandatory attributes of a feed. |
|
485 | + */ |
|
486 | + public $title, $description, $link; |
|
487 | + |
|
488 | + /** |
|
489 | + * Optional attributes of a feed. |
|
490 | + */ |
|
491 | + public $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays; |
|
492 | + |
|
493 | + /** |
|
494 | + * The url of the external xsl stylesheet used to format the naked rss feed. |
|
495 | + * Ignored in the output when empty. |
|
496 | + */ |
|
497 | + public $xslStyleSheet = ''; |
|
498 | + |
|
499 | + public $cssStyleSheet = ''; |
|
500 | + |
|
501 | + /** |
|
502 | + * @access private |
|
503 | + */ |
|
504 | + public $items = array(); |
|
505 | + |
|
506 | + /** |
|
507 | + * This feed's MIME content type. |
|
508 | + * @since 1.4 |
|
509 | + * @access private |
|
510 | + */ |
|
511 | + public $contentType = 'application/xml'; |
|
512 | + |
|
513 | + /** |
|
514 | + * This feed's character encoding. |
|
515 | + * @since 1.6.1 |
|
516 | + **/ |
|
517 | + public $encoding = 'ISO-8859-1'; |
|
518 | + |
|
519 | + /** |
|
520 | + * Any additional elements to include as an assiciated array. All $key => $value pairs |
|
521 | + * will be included unencoded in the feed in the form |
|
522 | + * <$key>$value</$key> |
|
523 | + * Again: No encoding will be used! This means you can invalidate or enhance the feed |
|
524 | + * if $value contains markup. This may be abused to embed tags not implemented by |
|
525 | + * the FeedCreator class used. |
|
526 | + */ |
|
527 | + public $additionalElements = array(); |
|
528 | + |
|
529 | + /** |
|
530 | + * Adds an FeedItem to the feed. |
|
531 | + * |
|
532 | + * @param $item |
|
533 | + * @internal param FeedItem $object $item The FeedItem to add to the feed. |
|
534 | + * @access public |
|
535 | + */ |
|
536 | + public function addItem($item) { |
|
537 | + $this->items[] = $item; |
|
538 | + } |
|
539 | + |
|
540 | + /** |
|
541 | + * Truncates a string to a certain length at the most sensible point. |
|
542 | + * First, if there's a '.' character near the end of the string, the string is truncated after this character. |
|
543 | + * If there is no '.', the string is truncated after the last ' ' character. |
|
544 | + * If the string is truncated, " ..." is appended. |
|
545 | + * If the string is already shorter than $length, it is returned unchanged. |
|
546 | + * |
|
547 | + * @static |
|
548 | + * @param string string A string to be truncated. |
|
549 | + * @param int length the maximum length the string should be truncated to |
|
550 | + * @return string the truncated string |
|
551 | + */ |
|
552 | + public function iTrunc($string, $length) { |
|
553 | + if (strlen($string) <= $length) { |
|
554 | + return $string; |
|
555 | + } |
|
556 | + |
|
557 | + $pos = strrpos($string, '.'); |
|
558 | + if ($pos >= $length - 4) { |
|
559 | + $string = substr($string, 0, $length - 4); |
|
560 | + $pos = strrpos($string, '.'); |
|
561 | + } |
|
562 | + if ($pos >= $length * 0.4) { |
|
563 | + return substr($string, 0, $pos + 1) . ' ...'; |
|
564 | + } |
|
565 | + |
|
566 | + $pos = strrpos($string, ' '); |
|
567 | + if ($pos >= $length - 4) { |
|
568 | + $string = substr($string, 0, $length - 4); |
|
569 | + $pos = strrpos($string, ' '); |
|
570 | + } |
|
571 | + if ($pos >= $length * 0.4) { |
|
572 | + return substr($string, 0, $pos) . ' ...'; |
|
573 | + } |
|
574 | + |
|
575 | + return substr($string, 0, $length - 4) . ' ...'; |
|
576 | + } |
|
577 | + |
|
578 | + /** |
|
579 | + * Creates a comment indicating the generator of this feed. |
|
580 | + * The format of this comment seems to be recognized by |
|
581 | + * Syndic8.com. |
|
582 | + */ |
|
583 | + public function _createGeneratorComment() { |
|
584 | + return "<!-- generator=\"" . FEEDCREATOR_VERSION . "\" -->\n"; |
|
585 | + } |
|
586 | + |
|
587 | + /** |
|
588 | + * Creates a string containing all additional elements specified in |
|
589 | + * $additionalElements. |
|
590 | + * @param array $elements |
|
591 | + * @param string $indentString |
|
592 | + * @return string the XML tags corresponding to $additionalElements |
|
593 | + * @internal param array $elements an associative array containing key => value pairs |
|
594 | + * @internal param string $indentString a string that will be inserted before every generated line |
|
595 | + */ |
|
596 | + public function _createAdditionalElements($elements, $indentString = '') { |
|
597 | + $ae = ''; |
|
598 | + if (is_array($elements)) { |
|
599 | + foreach ($elements as $key => $value) { |
|
600 | + $ae .= $indentString . "<$key>$value</$key>\n"; |
|
601 | + } |
|
602 | + } |
|
603 | + |
|
604 | + return $ae; |
|
605 | + } |
|
606 | + |
|
607 | + /** |
|
608 | + * @return string |
|
609 | + */ |
|
610 | + public function _createStylesheetReferences() { |
|
611 | + $xml = ''; |
|
612 | + if ($this->cssStyleSheet) { |
|
613 | + $xml .= "<?xml-stylesheet href=\"" . $this->cssStyleSheet . "\" type=\"text/css\"?>\n"; |
|
614 | + } |
|
615 | + if ($this->xslStyleSheet) { |
|
616 | + $xml .= "<?xml-stylesheet href=\"" . $this->xslStyleSheet . "\" type=\"text/xsl\"?>\n"; |
|
617 | + } |
|
618 | + |
|
619 | + return $xml; |
|
620 | + } |
|
621 | + |
|
622 | + /** |
|
623 | + * Builds the feed's text. |
|
624 | + * @abstract |
|
625 | + * @return string the feed's complete text |
|
626 | + */ |
|
627 | + public function createFeed() { |
|
628 | + } |
|
629 | + |
|
630 | + /** |
|
631 | + * Generate a filename for the feed cache file. The result will be $_SERVER["PHP_SELF"] with the extension changed to .xml. |
|
632 | + * For example: |
|
633 | + * |
|
634 | + * echo $_SERVER["PHP_SELF"]."\n"; |
|
635 | + * echo FeedCreator::_generateFilename(); |
|
636 | + * |
|
637 | + * would produce: |
|
638 | + * |
|
639 | + * /rss/latestnews.php |
|
640 | + * latestnews.xml |
|
641 | + * |
|
642 | + * @return string the feed cache filename |
|
643 | + * @since 1.4 |
|
644 | + * @access private |
|
645 | + */ |
|
646 | + public function _generateFilename() { |
|
647 | + $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
648 | + |
|
649 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.xml'; |
|
650 | + } |
|
651 | + |
|
652 | + /** |
|
653 | + * @since 1.4 |
|
654 | + * @access private |
|
655 | + * @param $filename |
|
656 | + */ |
|
657 | + public function _redirect($filename) { |
|
658 | + // attention, heavily-commented-out-area |
|
659 | + |
|
660 | + // maybe use this in addition to file time checking |
|
661 | + //Header("Expires: ".date("r",time()+$this->_timeout)); |
|
662 | + |
|
663 | + /* no caching at all, doesn't seem to work as good: |
|
664 | 664 | Header("Cache-Control: no-cache"); |
665 | 665 | Header("Pragma: no-cache"); |
666 | 666 | */ |
667 | 667 | |
668 | - // HTTP redirect, some feed readers' simple HTTP implementations don't follow it |
|
669 | - //Header("Location: ".$filename); |
|
670 | - |
|
671 | - header('Content-Type: ' . $this->contentType . '; charset=' . $this->encoding . '; filename=' |
|
672 | - . basename($filename)); |
|
673 | - header('Content-Disposition: inline; filename=' . basename($filename)); |
|
674 | - readfile($filename, 'r'); |
|
675 | - die(); |
|
676 | - } |
|
677 | - |
|
678 | - /** |
|
679 | - * Turns on caching and checks if there is a recent version of this feed in the cache. |
|
680 | - * If there is, an HTTP redirect header is sent. |
|
681 | - * To effectively use caching, you should create the FeedCreator object and call this method |
|
682 | - * before anything else, especially before you do the time consuming task to build the feed |
|
683 | - * (web fetching, for example). |
|
684 | - * @since 1.4 |
|
685 | - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
686 | - * @param int $timeout |
|
687 | - * @internal param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) |
|
688 | - */ |
|
689 | - public function useCached($filename = '', $timeout = 3600) { |
|
690 | - $this->_timeout = $timeout; |
|
691 | - if ($filename == '') { |
|
692 | - $filename = $this->_generateFilename(); |
|
693 | - } |
|
694 | - if (file_exists($filename) && (time() - filemtime($filename) < $timeout)) { |
|
695 | - $this->_redirect($filename); |
|
696 | - } |
|
697 | - } |
|
698 | - |
|
699 | - /** |
|
700 | - * Saves this feed as a file on the local disk. After the file is saved, a redirect |
|
701 | - * header may be sent to redirect the user to the newly created file. |
|
702 | - * @since 1.4 |
|
703 | - * |
|
704 | - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
705 | - * @param bool $displayContents |
|
706 | - * @internal param bool $redirect optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file. |
|
707 | - */ |
|
708 | - public function saveFeed($filename = '', $displayContents = true) { |
|
709 | - if ($filename == '') { |
|
710 | - $filename = $this->_generateFilename(); |
|
711 | - } |
|
712 | - $feedFile = fopen($filename, 'w+'); |
|
713 | - if ($feedFile) { |
|
714 | - fwrite($feedFile, $this->createFeed()); |
|
715 | - fclose($feedFile); |
|
716 | - if ($displayContents) { |
|
717 | - $this->_redirect($filename); |
|
718 | - } |
|
719 | - } else { |
|
720 | - echo '<br><b>Error creating feed file, please check write permissions.</b><br>'; |
|
721 | - } |
|
722 | - } |
|
668 | + // HTTP redirect, some feed readers' simple HTTP implementations don't follow it |
|
669 | + //Header("Location: ".$filename); |
|
670 | + |
|
671 | + header('Content-Type: ' . $this->contentType . '; charset=' . $this->encoding . '; filename=' |
|
672 | + . basename($filename)); |
|
673 | + header('Content-Disposition: inline; filename=' . basename($filename)); |
|
674 | + readfile($filename, 'r'); |
|
675 | + die(); |
|
676 | + } |
|
677 | + |
|
678 | + /** |
|
679 | + * Turns on caching and checks if there is a recent version of this feed in the cache. |
|
680 | + * If there is, an HTTP redirect header is sent. |
|
681 | + * To effectively use caching, you should create the FeedCreator object and call this method |
|
682 | + * before anything else, especially before you do the time consuming task to build the feed |
|
683 | + * (web fetching, for example). |
|
684 | + * @since 1.4 |
|
685 | + * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
686 | + * @param int $timeout |
|
687 | + * @internal param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) |
|
688 | + */ |
|
689 | + public function useCached($filename = '', $timeout = 3600) { |
|
690 | + $this->_timeout = $timeout; |
|
691 | + if ($filename == '') { |
|
692 | + $filename = $this->_generateFilename(); |
|
693 | + } |
|
694 | + if (file_exists($filename) && (time() - filemtime($filename) < $timeout)) { |
|
695 | + $this->_redirect($filename); |
|
696 | + } |
|
697 | + } |
|
698 | + |
|
699 | + /** |
|
700 | + * Saves this feed as a file on the local disk. After the file is saved, a redirect |
|
701 | + * header may be sent to redirect the user to the newly created file. |
|
702 | + * @since 1.4 |
|
703 | + * |
|
704 | + * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). |
|
705 | + * @param bool $displayContents |
|
706 | + * @internal param bool $redirect optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file. |
|
707 | + */ |
|
708 | + public function saveFeed($filename = '', $displayContents = true) { |
|
709 | + if ($filename == '') { |
|
710 | + $filename = $this->_generateFilename(); |
|
711 | + } |
|
712 | + $feedFile = fopen($filename, 'w+'); |
|
713 | + if ($feedFile) { |
|
714 | + fwrite($feedFile, $this->createFeed()); |
|
715 | + fclose($feedFile); |
|
716 | + if ($displayContents) { |
|
717 | + $this->_redirect($filename); |
|
718 | + } |
|
719 | + } else { |
|
720 | + echo '<br><b>Error creating feed file, please check write permissions.</b><br>'; |
|
721 | + } |
|
722 | + } |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | /** |
@@ -728,120 +728,120 @@ discard block |
||
728 | 728 | */ |
729 | 729 | class FeedDate |
730 | 730 | { |
731 | - public $unix; |
|
732 | - |
|
733 | - /** |
|
734 | - * Creates a new instance of FeedDate representing a given date. |
|
735 | - * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. |
|
736 | - * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used. |
|
737 | - */ |
|
738 | - public function __construct($dateString = '') { |
|
739 | - $tzOffset = 0; |
|
740 | - if ($dateString == '') { |
|
741 | - $dateString = date('r'); |
|
742 | - } |
|
743 | - |
|
744 | - //if (is_integer($dateString)) { |
|
745 | - if (is_numeric($dateString)) { |
|
746 | - $this->unix = $dateString; |
|
747 | - |
|
748 | - return; |
|
749 | - } |
|
750 | - if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~", |
|
751 | - $dateString, $matches)) { |
|
752 | - $months = array( |
|
753 | - 'Jan' => 1, |
|
754 | - 'Feb' => 2, |
|
755 | - 'Mar' => 3, |
|
756 | - 'Apr' => 4, |
|
757 | - 'May' => 5, |
|
758 | - 'Jun' => 6, |
|
759 | - 'Jul' => 7, |
|
760 | - 'Aug' => 8, |
|
761 | - 'Sep' => 9, |
|
762 | - 'Oct' => 10, |
|
763 | - 'Nov' => 11, |
|
764 | - 'Dec' => 12 |
|
765 | - ); |
|
766 | - $this->unix = mktime($matches[4], $matches[5], $matches[6], $months[$matches[2]], $matches[1], $matches[3]); |
|
767 | - if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
|
768 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
769 | - } else { |
|
770 | - if (strlen($matches[7]) == 1) { |
|
771 | - $oneHour = 3600; |
|
772 | - $ord = ord($matches[7]); |
|
773 | - if ($ord < ord('M')) { |
|
774 | - $tzOffset = (ord('A') - $ord - 1) * $oneHour; |
|
775 | - } elseif ($ord >= ord('M') && $matches[7] !== 'Z') { |
|
776 | - $tzOffset = ($ord - ord('M')) * $oneHour; |
|
777 | - } elseif ($matches[7] === 'Z') { |
|
778 | - $tzOffset = 0; |
|
779 | - } |
|
780 | - } |
|
781 | - switch ($matches[7]) { |
|
782 | - case 'UT': |
|
783 | - case 'GMT': |
|
784 | - $tzOffset = 0; |
|
785 | - } |
|
786 | - } |
|
787 | - $this->unix += $tzOffset; |
|
788 | - |
|
789 | - return; |
|
790 | - } |
|
791 | - if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~", $dateString, $matches)) { |
|
792 | - $this->unix = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
793 | - if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
|
794 | - $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
795 | - } else { |
|
796 | - if ($matches[7] === 'Z') { |
|
797 | - $tzOffset = 0; |
|
798 | - } |
|
799 | - } |
|
800 | - $this->unix += $tzOffset; |
|
801 | - |
|
802 | - return; |
|
803 | - } |
|
804 | - $this->unix = 0; |
|
805 | - } |
|
806 | - |
|
807 | - /** |
|
808 | - * Gets the date stored in this FeedDate as an RFC 822 date. |
|
809 | - * |
|
810 | - * @return a date in RFC 822 format |
|
811 | - */ |
|
812 | - public function rfc822() { |
|
813 | - //return gmdate("r",$this->unix); |
|
814 | - $date = gmdate('D, d M Y H:i:s', $this->unix); |
|
815 | - if (TIME_ZONE != '') { |
|
816 | - $date .= ' ' . str_replace(':', '', TIME_ZONE); |
|
817 | - } |
|
818 | - |
|
819 | - return $date; |
|
820 | - } |
|
821 | - |
|
822 | - /** |
|
823 | - * Gets the date stored in this FeedDate as an ISO 8601 date. |
|
824 | - * |
|
825 | - * @return a date in ISO 8601 format |
|
826 | - */ |
|
827 | - public function iso8601() { |
|
828 | - $date = gmdate("Y-m-d\TH:i:sO", $this->unix); |
|
829 | - $date = substr($date, 0, 22) . ':' . substr($date, -2); |
|
830 | - if (TIME_ZONE != '') { |
|
831 | - $date = str_replace('+00:00', TIME_ZONE, $date); |
|
832 | - } |
|
833 | - |
|
834 | - return $date; |
|
835 | - } |
|
836 | - |
|
837 | - /** |
|
838 | - * Gets the date stored in this FeedDate as unix time stamp. |
|
839 | - * |
|
840 | - * @return a date as a unix time stamp |
|
841 | - */ |
|
842 | - public function unix() { |
|
843 | - return $this->unix; |
|
844 | - } |
|
731 | + public $unix; |
|
732 | + |
|
733 | + /** |
|
734 | + * Creates a new instance of FeedDate representing a given date. |
|
735 | + * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. |
|
736 | + * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used. |
|
737 | + */ |
|
738 | + public function __construct($dateString = '') { |
|
739 | + $tzOffset = 0; |
|
740 | + if ($dateString == '') { |
|
741 | + $dateString = date('r'); |
|
742 | + } |
|
743 | + |
|
744 | + //if (is_integer($dateString)) { |
|
745 | + if (is_numeric($dateString)) { |
|
746 | + $this->unix = $dateString; |
|
747 | + |
|
748 | + return; |
|
749 | + } |
|
750 | + if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~", |
|
751 | + $dateString, $matches)) { |
|
752 | + $months = array( |
|
753 | + 'Jan' => 1, |
|
754 | + 'Feb' => 2, |
|
755 | + 'Mar' => 3, |
|
756 | + 'Apr' => 4, |
|
757 | + 'May' => 5, |
|
758 | + 'Jun' => 6, |
|
759 | + 'Jul' => 7, |
|
760 | + 'Aug' => 8, |
|
761 | + 'Sep' => 9, |
|
762 | + 'Oct' => 10, |
|
763 | + 'Nov' => 11, |
|
764 | + 'Dec' => 12 |
|
765 | + ); |
|
766 | + $this->unix = mktime($matches[4], $matches[5], $matches[6], $months[$matches[2]], $matches[1], $matches[3]); |
|
767 | + if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
|
768 | + $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
769 | + } else { |
|
770 | + if (strlen($matches[7]) == 1) { |
|
771 | + $oneHour = 3600; |
|
772 | + $ord = ord($matches[7]); |
|
773 | + if ($ord < ord('M')) { |
|
774 | + $tzOffset = (ord('A') - $ord - 1) * $oneHour; |
|
775 | + } elseif ($ord >= ord('M') && $matches[7] !== 'Z') { |
|
776 | + $tzOffset = ($ord - ord('M')) * $oneHour; |
|
777 | + } elseif ($matches[7] === 'Z') { |
|
778 | + $tzOffset = 0; |
|
779 | + } |
|
780 | + } |
|
781 | + switch ($matches[7]) { |
|
782 | + case 'UT': |
|
783 | + case 'GMT': |
|
784 | + $tzOffset = 0; |
|
785 | + } |
|
786 | + } |
|
787 | + $this->unix += $tzOffset; |
|
788 | + |
|
789 | + return; |
|
790 | + } |
|
791 | + if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~", $dateString, $matches)) { |
|
792 | + $this->unix = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
793 | + if (substr($matches[7], 0, 1) == '+' || substr($matches[7], 0, 1) == '-') { |
|
794 | + $tzOffset = (substr($matches[7], 0, 3) * 60 + substr($matches[7], -2)) * 60; |
|
795 | + } else { |
|
796 | + if ($matches[7] === 'Z') { |
|
797 | + $tzOffset = 0; |
|
798 | + } |
|
799 | + } |
|
800 | + $this->unix += $tzOffset; |
|
801 | + |
|
802 | + return; |
|
803 | + } |
|
804 | + $this->unix = 0; |
|
805 | + } |
|
806 | + |
|
807 | + /** |
|
808 | + * Gets the date stored in this FeedDate as an RFC 822 date. |
|
809 | + * |
|
810 | + * @return a date in RFC 822 format |
|
811 | + */ |
|
812 | + public function rfc822() { |
|
813 | + //return gmdate("r",$this->unix); |
|
814 | + $date = gmdate('D, d M Y H:i:s', $this->unix); |
|
815 | + if (TIME_ZONE != '') { |
|
816 | + $date .= ' ' . str_replace(':', '', TIME_ZONE); |
|
817 | + } |
|
818 | + |
|
819 | + return $date; |
|
820 | + } |
|
821 | + |
|
822 | + /** |
|
823 | + * Gets the date stored in this FeedDate as an ISO 8601 date. |
|
824 | + * |
|
825 | + * @return a date in ISO 8601 format |
|
826 | + */ |
|
827 | + public function iso8601() { |
|
828 | + $date = gmdate("Y-m-d\TH:i:sO", $this->unix); |
|
829 | + $date = substr($date, 0, 22) . ':' . substr($date, -2); |
|
830 | + if (TIME_ZONE != '') { |
|
831 | + $date = str_replace('+00:00', TIME_ZONE, $date); |
|
832 | + } |
|
833 | + |
|
834 | + return $date; |
|
835 | + } |
|
836 | + |
|
837 | + /** |
|
838 | + * Gets the date stored in this FeedDate as unix time stamp. |
|
839 | + * |
|
840 | + * @return a date as a unix time stamp |
|
841 | + */ |
|
842 | + public function unix() { |
|
843 | + return $this->unix; |
|
844 | + } |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | /** |
@@ -853,74 +853,74 @@ discard block |
||
853 | 853 | */ |
854 | 854 | class RSSCreator10 extends FeedCreator |
855 | 855 | { |
856 | - /** |
|
857 | - * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. |
|
858 | - * The feed will contain all items previously added in the same order. |
|
859 | - * @return string the feed's complete text |
|
860 | - */ |
|
861 | - public function createFeed() { |
|
862 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
863 | - $feed .= $this->_createGeneratorComment(); |
|
864 | - if ($this->cssStyleSheet == '') { |
|
865 | - $cssStyleSheet = 'http://www.w3.org/2000/08/w3c-synd/style.css'; |
|
866 | - } |
|
867 | - $feed .= $this->_createStylesheetReferences(); |
|
868 | - $feed .= "<rdf:RDF\n"; |
|
869 | - $feed .= " xmlns=\"http://purl.org/rss/1.0/\"\n"; |
|
870 | - $feed .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; |
|
871 | - $feed .= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n"; |
|
872 | - $feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; |
|
873 | - $feed .= " <channel rdf:about=\"" . $this->syndicationURL . "\">\n"; |
|
874 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
875 | - $feed .= ' <description>' . htmlspecialchars($this->description) . "</description>\n"; |
|
876 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
877 | - if ($this->image != null) { |
|
878 | - $feed .= " <image rdf:resource=\"" . $this->image->url . "\" />\n"; |
|
879 | - } |
|
880 | - $now = new FeedDate(); |
|
881 | - $feed .= ' <dc:date>' . htmlspecialchars($now->iso8601()) . "</dc:date>\n"; |
|
882 | - $feed .= " <items>\n"; |
|
883 | - $feed .= " <rdf:Seq>\n"; |
|
884 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
885 | - $feed .= " <rdf:li rdf:resource=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
886 | - } |
|
887 | - $feed .= " </rdf:Seq>\n"; |
|
888 | - $feed .= " </items>\n"; |
|
889 | - $feed .= " </channel>\n"; |
|
890 | - if ($this->image != null) { |
|
891 | - $feed .= " <image rdf:about=\"" . $this->image->url . "\">\n"; |
|
892 | - $feed .= ' <title>' . $this->image->title . "</title>\n"; |
|
893 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
894 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
895 | - $feed .= " </image>\n"; |
|
896 | - } |
|
897 | - $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
898 | - |
|
899 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
900 | - $feed .= " <item rdf:about=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
901 | - //$feed.= " <dc:type>Posting</dc:type>\n"; |
|
902 | - $feed .= " <dc:format>text/html</dc:format>\n"; |
|
903 | - if ($this->items[$i]->date != null) { |
|
904 | - $itemDate = new FeedDate($this->items[$i]->date); |
|
905 | - $feed .= ' <dc:date>' . htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n"; |
|
906 | - } |
|
907 | - if ($this->items[$i]->source != '') { |
|
908 | - $feed .= ' <dc:source>' . htmlspecialchars($this->items[$i]->source) . "</dc:source>\n"; |
|
909 | - } |
|
910 | - if ($this->items[$i]->author != '') { |
|
911 | - $feed .= ' <dc:creator>' . htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n"; |
|
912 | - } |
|
913 | - $feed .= ' <title>' . htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))) |
|
914 | - . "</title>\n"; |
|
915 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
916 | - $feed .= ' <description>' . htmlspecialchars($this->items[$i]->description) . "</description>\n"; |
|
917 | - $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
918 | - $feed .= " </item>\n"; |
|
919 | - } |
|
920 | - $feed .= "</rdf:RDF>\n"; |
|
921 | - |
|
922 | - return $feed; |
|
923 | - } |
|
856 | + /** |
|
857 | + * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. |
|
858 | + * The feed will contain all items previously added in the same order. |
|
859 | + * @return string the feed's complete text |
|
860 | + */ |
|
861 | + public function createFeed() { |
|
862 | + $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
863 | + $feed .= $this->_createGeneratorComment(); |
|
864 | + if ($this->cssStyleSheet == '') { |
|
865 | + $cssStyleSheet = 'http://www.w3.org/2000/08/w3c-synd/style.css'; |
|
866 | + } |
|
867 | + $feed .= $this->_createStylesheetReferences(); |
|
868 | + $feed .= "<rdf:RDF\n"; |
|
869 | + $feed .= " xmlns=\"http://purl.org/rss/1.0/\"\n"; |
|
870 | + $feed .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; |
|
871 | + $feed .= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n"; |
|
872 | + $feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; |
|
873 | + $feed .= " <channel rdf:about=\"" . $this->syndicationURL . "\">\n"; |
|
874 | + $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
875 | + $feed .= ' <description>' . htmlspecialchars($this->description) . "</description>\n"; |
|
876 | + $feed .= ' <link>' . $this->link . "</link>\n"; |
|
877 | + if ($this->image != null) { |
|
878 | + $feed .= " <image rdf:resource=\"" . $this->image->url . "\" />\n"; |
|
879 | + } |
|
880 | + $now = new FeedDate(); |
|
881 | + $feed .= ' <dc:date>' . htmlspecialchars($now->iso8601()) . "</dc:date>\n"; |
|
882 | + $feed .= " <items>\n"; |
|
883 | + $feed .= " <rdf:Seq>\n"; |
|
884 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
885 | + $feed .= " <rdf:li rdf:resource=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
886 | + } |
|
887 | + $feed .= " </rdf:Seq>\n"; |
|
888 | + $feed .= " </items>\n"; |
|
889 | + $feed .= " </channel>\n"; |
|
890 | + if ($this->image != null) { |
|
891 | + $feed .= " <image rdf:about=\"" . $this->image->url . "\">\n"; |
|
892 | + $feed .= ' <title>' . $this->image->title . "</title>\n"; |
|
893 | + $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
894 | + $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
895 | + $feed .= " </image>\n"; |
|
896 | + } |
|
897 | + $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
898 | + |
|
899 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
900 | + $feed .= " <item rdf:about=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n"; |
|
901 | + //$feed.= " <dc:type>Posting</dc:type>\n"; |
|
902 | + $feed .= " <dc:format>text/html</dc:format>\n"; |
|
903 | + if ($this->items[$i]->date != null) { |
|
904 | + $itemDate = new FeedDate($this->items[$i]->date); |
|
905 | + $feed .= ' <dc:date>' . htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n"; |
|
906 | + } |
|
907 | + if ($this->items[$i]->source != '') { |
|
908 | + $feed .= ' <dc:source>' . htmlspecialchars($this->items[$i]->source) . "</dc:source>\n"; |
|
909 | + } |
|
910 | + if ($this->items[$i]->author != '') { |
|
911 | + $feed .= ' <dc:creator>' . htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n"; |
|
912 | + } |
|
913 | + $feed .= ' <title>' . htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))) |
|
914 | + . "</title>\n"; |
|
915 | + $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
916 | + $feed .= ' <description>' . htmlspecialchars($this->items[$i]->description) . "</description>\n"; |
|
917 | + $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
918 | + $feed .= " </item>\n"; |
|
919 | + } |
|
920 | + $feed .= "</rdf:RDF>\n"; |
|
921 | + |
|
922 | + return $feed; |
|
923 | + } |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | /** |
@@ -932,141 +932,141 @@ discard block |
||
932 | 932 | */ |
933 | 933 | class RSSCreator091 extends FeedCreator |
934 | 934 | { |
935 | - /** |
|
936 | - * Stores this RSS feed's version number. |
|
937 | - * @access private |
|
938 | - */ |
|
939 | - public $RSSVersion; |
|
940 | - |
|
941 | - /** |
|
942 | - * RSSCreator091 constructor. |
|
943 | - */ |
|
944 | - public function __construct() { |
|
945 | - $this->_setRSSVersion('0.91'); |
|
946 | - $this->contentType = 'application/rss+xml'; |
|
947 | - } |
|
948 | - |
|
949 | - /** |
|
950 | - * Sets this RSS feed's version number. |
|
951 | - * @access private |
|
952 | - * @param $version |
|
953 | - */ |
|
954 | - public function _setRSSVersion($version) { |
|
955 | - $this->RSSVersion = $version; |
|
956 | - } |
|
957 | - |
|
958 | - /** |
|
959 | - * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. |
|
960 | - * The feed will contain all items previously added in the same order. |
|
961 | - * @return string the feed's complete text |
|
962 | - */ |
|
963 | - public function createFeed() { |
|
964 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
965 | - $feed .= $this->_createGeneratorComment(); |
|
966 | - $feed .= $this->_createStylesheetReferences(); |
|
967 | - $feed .= "<rss version=\"" . $this->RSSVersion . "\">\n"; |
|
968 | - $feed .= " <channel>\n"; |
|
969 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
970 | - $this->descriptionTruncSize = 500; |
|
971 | - $feed .= ' <description>' . $this->getDescription() . "</description>\n"; |
|
972 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
973 | - $now = new FeedDate(); |
|
974 | - $feed .= ' <lastBuildDate>' . htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n"; |
|
975 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
976 | - |
|
977 | - if ($this->image != null) { |
|
978 | - $feed .= " <image>\n"; |
|
979 | - $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
980 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
981 | - . "</title>\n"; |
|
982 | - $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
983 | - if ($this->image->width != '') { |
|
984 | - $feed .= ' <width>' . $this->image->width . "</width>\n"; |
|
985 | - } |
|
986 | - if ($this->image->height != '') { |
|
987 | - $feed .= ' <height>' . $this->image->height . "</height>\n"; |
|
988 | - } |
|
989 | - if ($this->image->description != '') { |
|
990 | - $feed .= ' <description>' . $this->image->getDescription() . "</description>\n"; |
|
991 | - } |
|
992 | - $feed .= " </image>\n"; |
|
993 | - } |
|
994 | - if ($this->language != '') { |
|
995 | - $feed .= ' <language>' . $this->language . "</language>\n"; |
|
996 | - } |
|
997 | - if ($this->copyright != '') { |
|
998 | - $feed .= ' <copyright>' . FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100) |
|
999 | - . "</copyright>\n"; |
|
1000 | - } |
|
1001 | - if ($this->editor != '') { |
|
1002 | - $feed .= ' <managingEditor>' . FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) |
|
1003 | - . "</managingEditor>\n"; |
|
1004 | - } |
|
1005 | - if ($this->webmaster != '') { |
|
1006 | - $feed .= ' <webMaster>' . FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) |
|
1007 | - . "</webMaster>\n"; |
|
1008 | - } |
|
1009 | - if ($this->pubDate != '') { |
|
1010 | - $pubDate = new FeedDate($this->pubDate); |
|
1011 | - $feed .= ' <pubDate>' . htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n"; |
|
1012 | - } |
|
1013 | - if ($this->category != '') { |
|
1014 | - $feed .= ' <category>' . htmlspecialchars($this->category) . "</category>\n"; |
|
1015 | - } |
|
1016 | - if ($this->docs != '') { |
|
1017 | - $feed .= ' <docs>' . FeedCreator::iTrunc(htmlspecialchars($this->docs), 500) . "</docs>\n"; |
|
1018 | - } |
|
1019 | - if ($this->ttl != '') { |
|
1020 | - $feed .= ' <ttl>' . htmlspecialchars($this->ttl) . "</ttl>\n"; |
|
1021 | - } |
|
1022 | - if ($this->rating != '') { |
|
1023 | - $feed .= ' <rating>' . FeedCreator::iTrunc(htmlspecialchars($this->rating), 500) . "</rating>\n"; |
|
1024 | - } |
|
1025 | - if ($this->skipHours != '') { |
|
1026 | - $feed .= ' <skipHours>' . htmlspecialchars($this->skipHours) . "</skipHours>\n"; |
|
1027 | - } |
|
1028 | - if ($this->skipDays != '') { |
|
1029 | - $feed .= ' <skipDays>' . htmlspecialchars($this->skipDays) . "</skipDays>\n"; |
|
1030 | - } |
|
1031 | - $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
1032 | - |
|
1033 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1034 | - $feed .= " <item>\n"; |
|
1035 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), |
|
1036 | - 100) . "</title>\n"; |
|
1037 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1038 | - $feed .= ' <description>' . $this->items[$i]->getDescription() . "</description>\n"; |
|
1039 | - |
|
1040 | - if ($this->items[$i]->author != '') { |
|
1041 | - $feed .= ' <author>' . htmlspecialchars($this->items[$i]->author) . "</author>\n"; |
|
1042 | - } |
|
1043 | - /* |
|
935 | + /** |
|
936 | + * Stores this RSS feed's version number. |
|
937 | + * @access private |
|
938 | + */ |
|
939 | + public $RSSVersion; |
|
940 | + |
|
941 | + /** |
|
942 | + * RSSCreator091 constructor. |
|
943 | + */ |
|
944 | + public function __construct() { |
|
945 | + $this->_setRSSVersion('0.91'); |
|
946 | + $this->contentType = 'application/rss+xml'; |
|
947 | + } |
|
948 | + |
|
949 | + /** |
|
950 | + * Sets this RSS feed's version number. |
|
951 | + * @access private |
|
952 | + * @param $version |
|
953 | + */ |
|
954 | + public function _setRSSVersion($version) { |
|
955 | + $this->RSSVersion = $version; |
|
956 | + } |
|
957 | + |
|
958 | + /** |
|
959 | + * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. |
|
960 | + * The feed will contain all items previously added in the same order. |
|
961 | + * @return string the feed's complete text |
|
962 | + */ |
|
963 | + public function createFeed() { |
|
964 | + $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
965 | + $feed .= $this->_createGeneratorComment(); |
|
966 | + $feed .= $this->_createStylesheetReferences(); |
|
967 | + $feed .= "<rss version=\"" . $this->RSSVersion . "\">\n"; |
|
968 | + $feed .= " <channel>\n"; |
|
969 | + $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
970 | + $this->descriptionTruncSize = 500; |
|
971 | + $feed .= ' <description>' . $this->getDescription() . "</description>\n"; |
|
972 | + $feed .= ' <link>' . $this->link . "</link>\n"; |
|
973 | + $now = new FeedDate(); |
|
974 | + $feed .= ' <lastBuildDate>' . htmlspecialchars($now->rfc822()) . "</lastBuildDate>\n"; |
|
975 | + $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
976 | + |
|
977 | + if ($this->image != null) { |
|
978 | + $feed .= " <image>\n"; |
|
979 | + $feed .= ' <url>' . $this->image->url . "</url>\n"; |
|
980 | + $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
981 | + . "</title>\n"; |
|
982 | + $feed .= ' <link>' . $this->image->link . "</link>\n"; |
|
983 | + if ($this->image->width != '') { |
|
984 | + $feed .= ' <width>' . $this->image->width . "</width>\n"; |
|
985 | + } |
|
986 | + if ($this->image->height != '') { |
|
987 | + $feed .= ' <height>' . $this->image->height . "</height>\n"; |
|
988 | + } |
|
989 | + if ($this->image->description != '') { |
|
990 | + $feed .= ' <description>' . $this->image->getDescription() . "</description>\n"; |
|
991 | + } |
|
992 | + $feed .= " </image>\n"; |
|
993 | + } |
|
994 | + if ($this->language != '') { |
|
995 | + $feed .= ' <language>' . $this->language . "</language>\n"; |
|
996 | + } |
|
997 | + if ($this->copyright != '') { |
|
998 | + $feed .= ' <copyright>' . FeedCreator::iTrunc(htmlspecialchars($this->copyright), 100) |
|
999 | + . "</copyright>\n"; |
|
1000 | + } |
|
1001 | + if ($this->editor != '') { |
|
1002 | + $feed .= ' <managingEditor>' . FeedCreator::iTrunc(htmlspecialchars($this->editor), 100) |
|
1003 | + . "</managingEditor>\n"; |
|
1004 | + } |
|
1005 | + if ($this->webmaster != '') { |
|
1006 | + $feed .= ' <webMaster>' . FeedCreator::iTrunc(htmlspecialchars($this->webmaster), 100) |
|
1007 | + . "</webMaster>\n"; |
|
1008 | + } |
|
1009 | + if ($this->pubDate != '') { |
|
1010 | + $pubDate = new FeedDate($this->pubDate); |
|
1011 | + $feed .= ' <pubDate>' . htmlspecialchars($pubDate->rfc822()) . "</pubDate>\n"; |
|
1012 | + } |
|
1013 | + if ($this->category != '') { |
|
1014 | + $feed .= ' <category>' . htmlspecialchars($this->category) . "</category>\n"; |
|
1015 | + } |
|
1016 | + if ($this->docs != '') { |
|
1017 | + $feed .= ' <docs>' . FeedCreator::iTrunc(htmlspecialchars($this->docs), 500) . "</docs>\n"; |
|
1018 | + } |
|
1019 | + if ($this->ttl != '') { |
|
1020 | + $feed .= ' <ttl>' . htmlspecialchars($this->ttl) . "</ttl>\n"; |
|
1021 | + } |
|
1022 | + if ($this->rating != '') { |
|
1023 | + $feed .= ' <rating>' . FeedCreator::iTrunc(htmlspecialchars($this->rating), 500) . "</rating>\n"; |
|
1024 | + } |
|
1025 | + if ($this->skipHours != '') { |
|
1026 | + $feed .= ' <skipHours>' . htmlspecialchars($this->skipHours) . "</skipHours>\n"; |
|
1027 | + } |
|
1028 | + if ($this->skipDays != '') { |
|
1029 | + $feed .= ' <skipDays>' . htmlspecialchars($this->skipDays) . "</skipDays>\n"; |
|
1030 | + } |
|
1031 | + $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
1032 | + |
|
1033 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1034 | + $feed .= " <item>\n"; |
|
1035 | + $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), |
|
1036 | + 100) . "</title>\n"; |
|
1037 | + $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1038 | + $feed .= ' <description>' . $this->items[$i]->getDescription() . "</description>\n"; |
|
1039 | + |
|
1040 | + if ($this->items[$i]->author != '') { |
|
1041 | + $feed .= ' <author>' . htmlspecialchars($this->items[$i]->author) . "</author>\n"; |
|
1042 | + } |
|
1043 | + /* |
|
1044 | 1044 | // on hold |
1045 | 1045 | if ($this->items[$i]->source!="") { |
1046 | 1046 | $feed.= " <source>".htmlspecialchars($this->items[$i]->source)."</source>\n"; |
1047 | 1047 | } |
1048 | 1048 | */ |
1049 | - if ($this->items[$i]->category != '') { |
|
1050 | - $feed .= ' <category>' . htmlspecialchars($this->items[$i]->category) . "</category>\n"; |
|
1051 | - } |
|
1052 | - if ($this->items[$i]->comments != '') { |
|
1053 | - $feed .= ' <comments>' . htmlspecialchars($this->items[$i]->comments) . "</comments>\n"; |
|
1054 | - } |
|
1055 | - if ($this->items[$i]->date != '') { |
|
1056 | - $itemDate = new FeedDate($this->items[$i]->date); |
|
1057 | - $feed .= ' <pubDate>' . htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n"; |
|
1058 | - } |
|
1059 | - if ($this->items[$i]->guid != '') { |
|
1060 | - $feed .= ' <guid>' . htmlspecialchars($this->items[$i]->guid) . "</guid>\n"; |
|
1061 | - } |
|
1062 | - $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
1063 | - $feed .= " </item>\n"; |
|
1064 | - } |
|
1065 | - $feed .= " </channel>\n"; |
|
1066 | - $feed .= "</rss>\n"; |
|
1067 | - |
|
1068 | - return $feed; |
|
1069 | - } |
|
1049 | + if ($this->items[$i]->category != '') { |
|
1050 | + $feed .= ' <category>' . htmlspecialchars($this->items[$i]->category) . "</category>\n"; |
|
1051 | + } |
|
1052 | + if ($this->items[$i]->comments != '') { |
|
1053 | + $feed .= ' <comments>' . htmlspecialchars($this->items[$i]->comments) . "</comments>\n"; |
|
1054 | + } |
|
1055 | + if ($this->items[$i]->date != '') { |
|
1056 | + $itemDate = new FeedDate($this->items[$i]->date); |
|
1057 | + $feed .= ' <pubDate>' . htmlspecialchars($itemDate->rfc822()) . "</pubDate>\n"; |
|
1058 | + } |
|
1059 | + if ($this->items[$i]->guid != '') { |
|
1060 | + $feed .= ' <guid>' . htmlspecialchars($this->items[$i]->guid) . "</guid>\n"; |
|
1061 | + } |
|
1062 | + $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
1063 | + $feed .= " </item>\n"; |
|
1064 | + } |
|
1065 | + $feed .= " </channel>\n"; |
|
1066 | + $feed .= "</rss>\n"; |
|
1067 | + |
|
1068 | + return $feed; |
|
1069 | + } |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
@@ -1078,12 +1078,12 @@ discard block |
||
1078 | 1078 | */ |
1079 | 1079 | class RSSCreator20 extends RSSCreator091 |
1080 | 1080 | { |
1081 | - /** |
|
1082 | - * RSSCreator20 constructor. |
|
1083 | - */ |
|
1084 | - public function __construct() { |
|
1085 | - parent::_setRSSVersion('2.0'); |
|
1086 | - } |
|
1081 | + /** |
|
1082 | + * RSSCreator20 constructor. |
|
1083 | + */ |
|
1084 | + public function __construct() { |
|
1085 | + parent::_setRSSVersion('2.0'); |
|
1086 | + } |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | /** |
@@ -1096,52 +1096,52 @@ discard block |
||
1096 | 1096 | */ |
1097 | 1097 | class PIECreator01 extends FeedCreator |
1098 | 1098 | { |
1099 | - /** |
|
1100 | - * PIECreator01 constructor. |
|
1101 | - */ |
|
1102 | - public function __construct() { |
|
1103 | - $this->encoding = 'utf-8'; |
|
1104 | - } |
|
1105 | - |
|
1106 | - /** |
|
1107 | - * @return string |
|
1108 | - */ |
|
1109 | - public function createFeed() { |
|
1110 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1111 | - $feed .= $this->_createStylesheetReferences(); |
|
1112 | - $feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; |
|
1113 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
1114 | - $this->truncSize = 500; |
|
1115 | - $feed .= ' <subtitle>' . $this->getDescription() . "</subtitle>\n"; |
|
1116 | - $feed .= ' <link>' . $this->link . "</link>\n"; |
|
1117 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1118 | - $feed .= " <entry>\n"; |
|
1119 | - $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1120 | - . "</title>\n"; |
|
1121 | - $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1122 | - $itemDate = new FeedDate($this->items[$i]->date); |
|
1123 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1124 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1125 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1126 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->guid) . "</id>\n"; |
|
1127 | - if ($this->items[$i]->author != '') { |
|
1128 | - $feed .= " <author>\n"; |
|
1129 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1130 | - if ($this->items[$i]->authorEmail != '') { |
|
1131 | - $feed .= ' <email>' . $this->items[$i]->authorEmail . "</email>\n"; |
|
1132 | - } |
|
1133 | - $feed .= " </author>\n"; |
|
1134 | - } |
|
1135 | - $feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n"; |
|
1136 | - $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() |
|
1137 | - . "</div>\n"; |
|
1138 | - $feed .= " </content>\n"; |
|
1139 | - $feed .= " </entry>\n"; |
|
1140 | - } |
|
1141 | - $feed .= "</feed>\n"; |
|
1142 | - |
|
1143 | - return $feed; |
|
1144 | - } |
|
1099 | + /** |
|
1100 | + * PIECreator01 constructor. |
|
1101 | + */ |
|
1102 | + public function __construct() { |
|
1103 | + $this->encoding = 'utf-8'; |
|
1104 | + } |
|
1105 | + |
|
1106 | + /** |
|
1107 | + * @return string |
|
1108 | + */ |
|
1109 | + public function createFeed() { |
|
1110 | + $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1111 | + $feed .= $this->_createStylesheetReferences(); |
|
1112 | + $feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; |
|
1113 | + $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n"; |
|
1114 | + $this->truncSize = 500; |
|
1115 | + $feed .= ' <subtitle>' . $this->getDescription() . "</subtitle>\n"; |
|
1116 | + $feed .= ' <link>' . $this->link . "</link>\n"; |
|
1117 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1118 | + $feed .= " <entry>\n"; |
|
1119 | + $feed .= ' <title>' . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1120 | + . "</title>\n"; |
|
1121 | + $feed .= ' <link>' . htmlspecialchars($this->items[$i]->link) . "</link>\n"; |
|
1122 | + $itemDate = new FeedDate($this->items[$i]->date); |
|
1123 | + $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1124 | + $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1125 | + $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1126 | + $feed .= ' <id>' . htmlspecialchars($this->items[$i]->guid) . "</id>\n"; |
|
1127 | + if ($this->items[$i]->author != '') { |
|
1128 | + $feed .= " <author>\n"; |
|
1129 | + $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1130 | + if ($this->items[$i]->authorEmail != '') { |
|
1131 | + $feed .= ' <email>' . $this->items[$i]->authorEmail . "</email>\n"; |
|
1132 | + } |
|
1133 | + $feed .= " </author>\n"; |
|
1134 | + } |
|
1135 | + $feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n"; |
|
1136 | + $feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() |
|
1137 | + . "</div>\n"; |
|
1138 | + $feed .= " </content>\n"; |
|
1139 | + $feed .= " </entry>\n"; |
|
1140 | + } |
|
1141 | + $feed .= "</feed>\n"; |
|
1142 | + |
|
1143 | + return $feed; |
|
1144 | + } |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | /** |
@@ -1162,70 +1162,70 @@ discard block |
||
1162 | 1162 | */ |
1163 | 1163 | class AtomCreator03 extends FeedCreator |
1164 | 1164 | { |
1165 | - /** |
|
1166 | - * AtomCreator03 constructor. |
|
1167 | - */ |
|
1168 | - public function __construct() { |
|
1169 | - $this->contentType = 'application/atom+xml'; |
|
1170 | - $this->encoding = 'utf-8'; |
|
1171 | - } |
|
1172 | - |
|
1173 | - /** |
|
1174 | - * @return string |
|
1175 | - */ |
|
1176 | - public function createFeed() { |
|
1177 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1178 | - $feed .= $this->_createGeneratorComment(); |
|
1179 | - $feed .= $this->_createStylesheetReferences(); |
|
1180 | - $feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; |
|
1181 | - if ($this->language != '') { |
|
1182 | - $feed .= " xml:lang=\"" . $this->language . "\""; |
|
1183 | - } |
|
1184 | - $feed .= ">\n"; |
|
1185 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1186 | - $feed .= ' <tagline>' . htmlspecialchars($this->description) . "</tagline>\n"; |
|
1187 | - $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n"; |
|
1188 | - $feed .= ' <id>' . htmlspecialchars($this->link) . "</id>\n"; |
|
1189 | - $now = new FeedDate(); |
|
1190 | - $feed .= ' <modified>' . htmlspecialchars($now->iso8601()) . "</modified>\n"; |
|
1191 | - if ($this->editor != '') { |
|
1192 | - $feed .= " <author>\n"; |
|
1193 | - $feed .= ' <name>' . $this->editor . "</name>\n"; |
|
1194 | - if ($this->editorEmail != '') { |
|
1195 | - $feed .= ' <email>' . $this->editorEmail . "</email>\n"; |
|
1196 | - } |
|
1197 | - $feed .= " </author>\n"; |
|
1198 | - } |
|
1199 | - $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
1200 | - $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
1201 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1202 | - $feed .= " <entry>\n"; |
|
1203 | - $feed .= ' <title>' . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n"; |
|
1204 | - $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" |
|
1205 | - . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
1206 | - if ($this->items[$i]->date == '') { |
|
1207 | - $this->items[$i]->date = time(); |
|
1208 | - } |
|
1209 | - $itemDate = new FeedDate($this->items[$i]->date); |
|
1210 | - $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1211 | - $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1212 | - $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1213 | - $feed .= ' <id>' . htmlspecialchars($this->items[$i]->link) . "</id>\n"; |
|
1214 | - $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
1215 | - if ($this->items[$i]->author != '') { |
|
1216 | - $feed .= " <author>\n"; |
|
1217 | - $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1218 | - $feed .= " </author>\n"; |
|
1219 | - } |
|
1220 | - if ($this->items[$i]->description != '') { |
|
1221 | - $feed .= ' <summary>' . htmlspecialchars($this->items[$i]->description) . "</summary>\n"; |
|
1222 | - } |
|
1223 | - $feed .= " </entry>\n"; |
|
1224 | - } |
|
1225 | - $feed .= "</feed>\n"; |
|
1226 | - |
|
1227 | - return $feed; |
|
1228 | - } |
|
1165 | + /** |
|
1166 | + * AtomCreator03 constructor. |
|
1167 | + */ |
|
1168 | + public function __construct() { |
|
1169 | + $this->contentType = 'application/atom+xml'; |
|
1170 | + $this->encoding = 'utf-8'; |
|
1171 | + } |
|
1172 | + |
|
1173 | + /** |
|
1174 | + * @return string |
|
1175 | + */ |
|
1176 | + public function createFeed() { |
|
1177 | + $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1178 | + $feed .= $this->_createGeneratorComment(); |
|
1179 | + $feed .= $this->_createStylesheetReferences(); |
|
1180 | + $feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\""; |
|
1181 | + if ($this->language != '') { |
|
1182 | + $feed .= " xml:lang=\"" . $this->language . "\""; |
|
1183 | + } |
|
1184 | + $feed .= ">\n"; |
|
1185 | + $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1186 | + $feed .= ' <tagline>' . htmlspecialchars($this->description) . "</tagline>\n"; |
|
1187 | + $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n"; |
|
1188 | + $feed .= ' <id>' . htmlspecialchars($this->link) . "</id>\n"; |
|
1189 | + $now = new FeedDate(); |
|
1190 | + $feed .= ' <modified>' . htmlspecialchars($now->iso8601()) . "</modified>\n"; |
|
1191 | + if ($this->editor != '') { |
|
1192 | + $feed .= " <author>\n"; |
|
1193 | + $feed .= ' <name>' . $this->editor . "</name>\n"; |
|
1194 | + if ($this->editorEmail != '') { |
|
1195 | + $feed .= ' <email>' . $this->editorEmail . "</email>\n"; |
|
1196 | + } |
|
1197 | + $feed .= " </author>\n"; |
|
1198 | + } |
|
1199 | + $feed .= ' <generator>' . FEEDCREATOR_VERSION . "</generator>\n"; |
|
1200 | + $feed .= $this->_createAdditionalElements($this->additionalElements, ' '); |
|
1201 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1202 | + $feed .= " <entry>\n"; |
|
1203 | + $feed .= ' <title>' . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n"; |
|
1204 | + $feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" |
|
1205 | + . htmlspecialchars($this->items[$i]->link) . "\"/>\n"; |
|
1206 | + if ($this->items[$i]->date == '') { |
|
1207 | + $this->items[$i]->date = time(); |
|
1208 | + } |
|
1209 | + $itemDate = new FeedDate($this->items[$i]->date); |
|
1210 | + $feed .= ' <created>' . htmlspecialchars($itemDate->iso8601()) . "</created>\n"; |
|
1211 | + $feed .= ' <issued>' . htmlspecialchars($itemDate->iso8601()) . "</issued>\n"; |
|
1212 | + $feed .= ' <modified>' . htmlspecialchars($itemDate->iso8601()) . "</modified>\n"; |
|
1213 | + $feed .= ' <id>' . htmlspecialchars($this->items[$i]->link) . "</id>\n"; |
|
1214 | + $feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, ' '); |
|
1215 | + if ($this->items[$i]->author != '') { |
|
1216 | + $feed .= " <author>\n"; |
|
1217 | + $feed .= ' <name>' . htmlspecialchars($this->items[$i]->author) . "</name>\n"; |
|
1218 | + $feed .= " </author>\n"; |
|
1219 | + } |
|
1220 | + if ($this->items[$i]->description != '') { |
|
1221 | + $feed .= ' <summary>' . htmlspecialchars($this->items[$i]->description) . "</summary>\n"; |
|
1222 | + } |
|
1223 | + $feed .= " </entry>\n"; |
|
1224 | + } |
|
1225 | + $feed .= "</feed>\n"; |
|
1226 | + |
|
1227 | + return $feed; |
|
1228 | + } |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | /** |
@@ -1237,93 +1237,93 @@ discard block |
||
1237 | 1237 | */ |
1238 | 1238 | class MBOXCreator extends FeedCreator |
1239 | 1239 | { |
1240 | - /** |
|
1241 | - * MBOXCreator constructor. |
|
1242 | - */ |
|
1243 | - public function __construct() { |
|
1244 | - $this->contentType = 'text/plain'; |
|
1245 | - $this->encoding = 'ISO-8859-15'; |
|
1246 | - } |
|
1247 | - |
|
1248 | - /** |
|
1249 | - * @param string $input |
|
1250 | - * @param int $line_max |
|
1251 | - * @return string |
|
1252 | - */ |
|
1253 | - public function qp_enc($input = '', $line_max = 76) { |
|
1254 | - $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
1255 | - $lines = preg_split("/(?:\r\n|\r|\n)/", $input); |
|
1256 | - $eol = "\r\n"; |
|
1257 | - $escape = '='; |
|
1258 | - $output = ''; |
|
1259 | - while (list(, $line) = each($lines)) { |
|
1260 | - //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary |
|
1261 | - $linlen = strlen($line); |
|
1262 | - $newline = ''; |
|
1263 | - for ($i = 0; $i < $linlen; ++$i) { |
|
1264 | - $c = substr($line, $i, 1); |
|
1265 | - $dec = ord($c); |
|
1266 | - if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only |
|
1267 | - $c = '=20'; |
|
1268 | - } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required |
|
1269 | - $h2 = floor($dec / 16); |
|
1270 | - $h1 = floor($dec % 16); |
|
1271 | - $c = $escape . $hex["$h2"] . $hex["$h1"]; |
|
1272 | - } |
|
1273 | - if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted |
|
1274 | - $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay |
|
1275 | - $newline = ''; |
|
1276 | - } |
|
1277 | - $newline .= $c; |
|
1278 | - } // end of for |
|
1279 | - $output .= $newline . $eol; |
|
1280 | - } |
|
1281 | - |
|
1282 | - return trim($output); |
|
1283 | - } |
|
1284 | - |
|
1285 | - /** |
|
1286 | - * Builds the MBOX contents. |
|
1287 | - * @return string the feed's complete text |
|
1288 | - */ |
|
1289 | - public function createFeed() { |
|
1290 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1291 | - if ($this->items[$i]->author != '') { |
|
1292 | - $from = $this->items[$i]->author; |
|
1293 | - } else { |
|
1294 | - $from = $this->title; |
|
1295 | - } |
|
1296 | - $itemDate = new FeedDate($this->items[$i]->date); |
|
1297 | - $feed .= 'From ' . strtr(MBOXCreator::qp_enc($from), ' ', '_') . ' ' . date('D M d H:i:s Y', |
|
1298 | - $itemDate->unix()) . "\n"; |
|
1299 | - $feed .= "Content-Type: text/plain;\n"; |
|
1300 | - $feed .= " charset=\"" . $this->encoding . "\"\n"; |
|
1301 | - $feed .= "Content-Transfer-Encoding: quoted-printable\n"; |
|
1302 | - $feed .= "Content-Type: text/plain\n"; |
|
1303 | - $feed .= "From: \"" . MBOXCreator::qp_enc($from) . "\"\n"; |
|
1304 | - $feed .= 'Date: ' . $itemDate->rfc822() . "\n"; |
|
1305 | - $feed .= 'Subject: ' . MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "\n"; |
|
1306 | - $feed .= "\n"; |
|
1307 | - $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); |
|
1308 | - $feed .= preg_replace("~\nFrom ([^\n]*)(\n?)~", "\n>From $1$2\n", $body); |
|
1309 | - $feed .= "\n"; |
|
1310 | - $feed .= "\n"; |
|
1311 | - } |
|
1312 | - |
|
1313 | - return $feed; |
|
1314 | - } |
|
1315 | - |
|
1316 | - /** |
|
1317 | - * Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types. |
|
1318 | - * @return string the feed cache filename |
|
1319 | - * @since 1.4 |
|
1320 | - * @access private |
|
1321 | - */ |
|
1322 | - public function _generateFilename() { |
|
1323 | - $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1324 | - |
|
1325 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.mbox'; |
|
1326 | - } |
|
1240 | + /** |
|
1241 | + * MBOXCreator constructor. |
|
1242 | + */ |
|
1243 | + public function __construct() { |
|
1244 | + $this->contentType = 'text/plain'; |
|
1245 | + $this->encoding = 'ISO-8859-15'; |
|
1246 | + } |
|
1247 | + |
|
1248 | + /** |
|
1249 | + * @param string $input |
|
1250 | + * @param int $line_max |
|
1251 | + * @return string |
|
1252 | + */ |
|
1253 | + public function qp_enc($input = '', $line_max = 76) { |
|
1254 | + $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
1255 | + $lines = preg_split("/(?:\r\n|\r|\n)/", $input); |
|
1256 | + $eol = "\r\n"; |
|
1257 | + $escape = '='; |
|
1258 | + $output = ''; |
|
1259 | + while (list(, $line) = each($lines)) { |
|
1260 | + //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary |
|
1261 | + $linlen = strlen($line); |
|
1262 | + $newline = ''; |
|
1263 | + for ($i = 0; $i < $linlen; ++$i) { |
|
1264 | + $c = substr($line, $i, 1); |
|
1265 | + $dec = ord($c); |
|
1266 | + if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only |
|
1267 | + $c = '=20'; |
|
1268 | + } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required |
|
1269 | + $h2 = floor($dec / 16); |
|
1270 | + $h1 = floor($dec % 16); |
|
1271 | + $c = $escape . $hex["$h2"] . $hex["$h1"]; |
|
1272 | + } |
|
1273 | + if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted |
|
1274 | + $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay |
|
1275 | + $newline = ''; |
|
1276 | + } |
|
1277 | + $newline .= $c; |
|
1278 | + } // end of for |
|
1279 | + $output .= $newline . $eol; |
|
1280 | + } |
|
1281 | + |
|
1282 | + return trim($output); |
|
1283 | + } |
|
1284 | + |
|
1285 | + /** |
|
1286 | + * Builds the MBOX contents. |
|
1287 | + * @return string the feed's complete text |
|
1288 | + */ |
|
1289 | + public function createFeed() { |
|
1290 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1291 | + if ($this->items[$i]->author != '') { |
|
1292 | + $from = $this->items[$i]->author; |
|
1293 | + } else { |
|
1294 | + $from = $this->title; |
|
1295 | + } |
|
1296 | + $itemDate = new FeedDate($this->items[$i]->date); |
|
1297 | + $feed .= 'From ' . strtr(MBOXCreator::qp_enc($from), ' ', '_') . ' ' . date('D M d H:i:s Y', |
|
1298 | + $itemDate->unix()) . "\n"; |
|
1299 | + $feed .= "Content-Type: text/plain;\n"; |
|
1300 | + $feed .= " charset=\"" . $this->encoding . "\"\n"; |
|
1301 | + $feed .= "Content-Transfer-Encoding: quoted-printable\n"; |
|
1302 | + $feed .= "Content-Type: text/plain\n"; |
|
1303 | + $feed .= "From: \"" . MBOXCreator::qp_enc($from) . "\"\n"; |
|
1304 | + $feed .= 'Date: ' . $itemDate->rfc822() . "\n"; |
|
1305 | + $feed .= 'Subject: ' . MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title, 100)) . "\n"; |
|
1306 | + $feed .= "\n"; |
|
1307 | + $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); |
|
1308 | + $feed .= preg_replace("~\nFrom ([^\n]*)(\n?)~", "\n>From $1$2\n", $body); |
|
1309 | + $feed .= "\n"; |
|
1310 | + $feed .= "\n"; |
|
1311 | + } |
|
1312 | + |
|
1313 | + return $feed; |
|
1314 | + } |
|
1315 | + |
|
1316 | + /** |
|
1317 | + * Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types. |
|
1318 | + * @return string the feed cache filename |
|
1319 | + * @since 1.4 |
|
1320 | + * @access private |
|
1321 | + */ |
|
1322 | + public function _generateFilename() { |
|
1323 | + $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1324 | + |
|
1325 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.mbox'; |
|
1326 | + } |
|
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | /** |
@@ -1335,53 +1335,53 @@ discard block |
||
1335 | 1335 | */ |
1336 | 1336 | class OPMLCreator extends FeedCreator |
1337 | 1337 | { |
1338 | - /** |
|
1339 | - * OPMLCreator constructor. |
|
1340 | - */ |
|
1341 | - public function __construct() { |
|
1342 | - $this->encoding = 'utf-8'; |
|
1343 | - } |
|
1344 | - |
|
1345 | - /** |
|
1346 | - * @return string |
|
1347 | - */ |
|
1348 | - public function createFeed() { |
|
1349 | - $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1350 | - $feed .= $this->_createGeneratorComment(); |
|
1351 | - $feed .= $this->_createStylesheetReferences(); |
|
1352 | - $feed .= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; |
|
1353 | - $feed .= " <head>\n"; |
|
1354 | - $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1355 | - if ($this->pubDate != '') { |
|
1356 | - $date = new FeedDate($this->pubDate); |
|
1357 | - $feed .= ' <dateCreated>' . $date->rfc822() . "</dateCreated>\n"; |
|
1358 | - } |
|
1359 | - if ($this->lastBuildDate != '') { |
|
1360 | - $date = new FeedDate($this->lastBuildDate); |
|
1361 | - $feed .= ' <dateModified>' . $date->rfc822() . "</dateModified>\n"; |
|
1362 | - } |
|
1363 | - if ($this->editor != '') { |
|
1364 | - $feed .= ' <ownerName>' . $this->editor . "</ownerName>\n"; |
|
1365 | - } |
|
1366 | - if ($this->editorEmail != '') { |
|
1367 | - $feed .= ' <ownerEmail>' . $this->editorEmail . "</ownerEmail>\n"; |
|
1368 | - } |
|
1369 | - $feed .= " </head>\n"; |
|
1370 | - $feed .= " <body>\n"; |
|
1371 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1372 | - $feed .= " <outline type=\"rss\" "; |
|
1373 | - $title = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))); |
|
1374 | - $feed .= " title=\"" . $title . "\""; |
|
1375 | - $feed .= " text=\"" . $title . "\""; |
|
1376 | - //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\""; |
|
1377 | - $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link) . "\""; |
|
1378 | - $feed .= "/>\n"; |
|
1379 | - } |
|
1380 | - $feed .= " </body>\n"; |
|
1381 | - $feed .= "</opml>\n"; |
|
1382 | - |
|
1383 | - return $feed; |
|
1384 | - } |
|
1338 | + /** |
|
1339 | + * OPMLCreator constructor. |
|
1340 | + */ |
|
1341 | + public function __construct() { |
|
1342 | + $this->encoding = 'utf-8'; |
|
1343 | + } |
|
1344 | + |
|
1345 | + /** |
|
1346 | + * @return string |
|
1347 | + */ |
|
1348 | + public function createFeed() { |
|
1349 | + $feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n"; |
|
1350 | + $feed .= $this->_createGeneratorComment(); |
|
1351 | + $feed .= $this->_createStylesheetReferences(); |
|
1352 | + $feed .= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"; |
|
1353 | + $feed .= " <head>\n"; |
|
1354 | + $feed .= ' <title>' . htmlspecialchars($this->title) . "</title>\n"; |
|
1355 | + if ($this->pubDate != '') { |
|
1356 | + $date = new FeedDate($this->pubDate); |
|
1357 | + $feed .= ' <dateCreated>' . $date->rfc822() . "</dateCreated>\n"; |
|
1358 | + } |
|
1359 | + if ($this->lastBuildDate != '') { |
|
1360 | + $date = new FeedDate($this->lastBuildDate); |
|
1361 | + $feed .= ' <dateModified>' . $date->rfc822() . "</dateModified>\n"; |
|
1362 | + } |
|
1363 | + if ($this->editor != '') { |
|
1364 | + $feed .= ' <ownerName>' . $this->editor . "</ownerName>\n"; |
|
1365 | + } |
|
1366 | + if ($this->editorEmail != '') { |
|
1367 | + $feed .= ' <ownerEmail>' . $this->editorEmail . "</ownerEmail>\n"; |
|
1368 | + } |
|
1369 | + $feed .= " </head>\n"; |
|
1370 | + $feed .= " <body>\n"; |
|
1371 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1372 | + $feed .= " <outline type=\"rss\" "; |
|
1373 | + $title = htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", ' '))); |
|
1374 | + $feed .= " title=\"" . $title . "\""; |
|
1375 | + $feed .= " text=\"" . $title . "\""; |
|
1376 | + //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\""; |
|
1377 | + $feed .= " url=\"" . htmlspecialchars($this->items[$i]->link) . "\""; |
|
1378 | + $feed .= "/>\n"; |
|
1379 | + } |
|
1380 | + $feed .= " </body>\n"; |
|
1381 | + $feed .= "</opml>\n"; |
|
1382 | + |
|
1383 | + return $feed; |
|
1384 | + } |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | /** |
@@ -1397,146 +1397,146 @@ discard block |
||
1397 | 1397 | */ |
1398 | 1398 | class HTMLCreator extends FeedCreator |
1399 | 1399 | { |
1400 | - public $contentType = 'text/html'; |
|
1401 | - |
|
1402 | - /** |
|
1403 | - * Contains HTML to be output at the start of the feed's html representation. |
|
1404 | - */ |
|
1405 | - public $header; |
|
1406 | - |
|
1407 | - /** |
|
1408 | - * Contains HTML to be output at the end of the feed's html representation. |
|
1409 | - */ |
|
1410 | - public $footer; |
|
1411 | - |
|
1412 | - /** |
|
1413 | - * Contains HTML to be output between entries. A separator is only used in |
|
1414 | - * case of multiple entries. |
|
1415 | - */ |
|
1416 | - public $separator; |
|
1417 | - |
|
1418 | - /** |
|
1419 | - * Used to prefix the stylenames to make sure they are unique |
|
1420 | - * and do not clash with stylenames on the users' page. |
|
1421 | - */ |
|
1422 | - public $stylePrefix; |
|
1423 | - |
|
1424 | - /** |
|
1425 | - * Determines whether the links open in a new window or not. |
|
1426 | - */ |
|
1427 | - public $openInNewWindow = true; |
|
1428 | - |
|
1429 | - public $imageAlign = 'right'; |
|
1430 | - |
|
1431 | - /** |
|
1432 | - * In case of very simple output you may want to get rid of the style tags, |
|
1433 | - * hence this variable. There's no equivalent on item level, but of course you can |
|
1434 | - * add strings to it while iterating over the items ($this->stylelessOutput .= ...) |
|
1435 | - * and when it is non-empty, ONLY the styleless output is printed, the rest is ignored |
|
1436 | - * in the function createFeed(). |
|
1437 | - */ |
|
1438 | - public $stylelessOutput = ''; |
|
1439 | - |
|
1440 | - /** |
|
1441 | - * Writes the HTML. |
|
1442 | - * @return string the scripts's complete text |
|
1443 | - */ |
|
1444 | - public function createFeed() { |
|
1445 | - // if there is styleless output, use the content of this variable and ignore the rest |
|
1446 | - if ($this->stylelessOutput != '') { |
|
1447 | - return $this->stylelessOutput; |
|
1448 | - } |
|
1449 | - |
|
1450 | - //if no stylePrefix is set, generate it yourself depending on the script name |
|
1451 | - if ($this->stylePrefix == '') { |
|
1452 | - $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()) . '_'; |
|
1453 | - } |
|
1454 | - |
|
1455 | - //set an openInNewWindow_token_to be inserted or not |
|
1456 | - if ($this->openInNewWindow) { |
|
1457 | - $targetInsert = " target='_blank'"; |
|
1458 | - } |
|
1459 | - |
|
1460 | - // use this array to put the lines in and implode later with "document.write" javascript |
|
1461 | - $feedArray = array(); |
|
1462 | - if ($this->image != null) { |
|
1463 | - $imageStr = "<a href='" . $this->image->link . "'" . $targetInsert . '>' . "<img src='" . $this->image->url |
|
1464 | - . "' border='0' alt='" . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
1465 | - . "' align='" . $this->imageAlign . "' "; |
|
1466 | - if ($this->image->width) { |
|
1467 | - $imageStr .= " width='" . $this->image->width . "' "; |
|
1468 | - } |
|
1469 | - if ($this->image->height) { |
|
1470 | - $imageStr .= " height='" . $this->image->height . "' "; |
|
1471 | - } |
|
1472 | - $imageStr .= '/></a>'; |
|
1473 | - $feedArray[] = $imageStr; |
|
1474 | - } |
|
1475 | - |
|
1476 | - if ($this->title) { |
|
1477 | - $feedArray[] = "<div class='" . $this->stylePrefix . "title'><a href='" . $this->link . "' " . $targetInsert |
|
1478 | - . " class='" . $this->stylePrefix . "title'>" |
|
1479 | - . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . '</a></div>'; |
|
1480 | - } |
|
1481 | - if ($this->getDescription()) { |
|
1482 | - $feedArray[] = "<div class='" . $this->stylePrefix . "description'>" . str_replace(']]>', '', |
|
1483 | - str_replace('<![CDATA[', |
|
1484 | - '', |
|
1485 | - $this->getDescription())) |
|
1486 | - . '</div>'; |
|
1487 | - } |
|
1488 | - |
|
1489 | - if ($this->header) { |
|
1490 | - $feedArray[] = "<div class='" . $this->stylePrefix . "header'>" . $this->header . '</div>'; |
|
1491 | - } |
|
1492 | - |
|
1493 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1494 | - if ($this->separator && $i > 0) { |
|
1495 | - $feedArray[] = "<div class='" . $this->stylePrefix . "separator'>" . $this->separator . '</div>'; |
|
1496 | - } |
|
1497 | - |
|
1498 | - if ($this->items[$i]->title) { |
|
1499 | - if ($this->items[$i]->link) { |
|
1500 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'><a href='" |
|
1501 | - . $this->items[$i]->link . "' class='" . $this->stylePrefix . "item_title'" |
|
1502 | - . $targetInsert . '>' |
|
1503 | - . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1504 | - . '</a></div>'; |
|
1505 | - } else { |
|
1506 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'>" |
|
1507 | - . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1508 | - . '</div>'; |
|
1509 | - } |
|
1510 | - } |
|
1511 | - if ($this->items[$i]->getDescription()) { |
|
1512 | - $feedArray[] = "<div class='" . $this->stylePrefix . "item_description'>" . str_replace(']]>', '', |
|
1513 | - str_replace('<![CDATA[', |
|
1514 | - '', |
|
1515 | - $this->items[$i]->getDescription())) |
|
1516 | - . '</div>'; |
|
1517 | - } |
|
1518 | - } |
|
1519 | - if ($this->footer) { |
|
1520 | - $feedArray[] = "<div class='" . $this->stylePrefix . "footer'>" . $this->footer . '</div>'; |
|
1521 | - } |
|
1522 | - |
|
1523 | - $feed = '' . implode($feedArray, "\r\n"); |
|
1524 | - |
|
1525 | - return $feed; |
|
1526 | - } |
|
1527 | - |
|
1528 | - /** |
|
1529 | - * Overrrides parent to produce .html extensions |
|
1530 | - * |
|
1531 | - * @return string the feed cache filename |
|
1532 | - * @since 1.4 |
|
1533 | - * @access private |
|
1534 | - */ |
|
1535 | - public function _generateFilename() { |
|
1536 | - $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1537 | - |
|
1538 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.html'; |
|
1539 | - } |
|
1400 | + public $contentType = 'text/html'; |
|
1401 | + |
|
1402 | + /** |
|
1403 | + * Contains HTML to be output at the start of the feed's html representation. |
|
1404 | + */ |
|
1405 | + public $header; |
|
1406 | + |
|
1407 | + /** |
|
1408 | + * Contains HTML to be output at the end of the feed's html representation. |
|
1409 | + */ |
|
1410 | + public $footer; |
|
1411 | + |
|
1412 | + /** |
|
1413 | + * Contains HTML to be output between entries. A separator is only used in |
|
1414 | + * case of multiple entries. |
|
1415 | + */ |
|
1416 | + public $separator; |
|
1417 | + |
|
1418 | + /** |
|
1419 | + * Used to prefix the stylenames to make sure they are unique |
|
1420 | + * and do not clash with stylenames on the users' page. |
|
1421 | + */ |
|
1422 | + public $stylePrefix; |
|
1423 | + |
|
1424 | + /** |
|
1425 | + * Determines whether the links open in a new window or not. |
|
1426 | + */ |
|
1427 | + public $openInNewWindow = true; |
|
1428 | + |
|
1429 | + public $imageAlign = 'right'; |
|
1430 | + |
|
1431 | + /** |
|
1432 | + * In case of very simple output you may want to get rid of the style tags, |
|
1433 | + * hence this variable. There's no equivalent on item level, but of course you can |
|
1434 | + * add strings to it while iterating over the items ($this->stylelessOutput .= ...) |
|
1435 | + * and when it is non-empty, ONLY the styleless output is printed, the rest is ignored |
|
1436 | + * in the function createFeed(). |
|
1437 | + */ |
|
1438 | + public $stylelessOutput = ''; |
|
1439 | + |
|
1440 | + /** |
|
1441 | + * Writes the HTML. |
|
1442 | + * @return string the scripts's complete text |
|
1443 | + */ |
|
1444 | + public function createFeed() { |
|
1445 | + // if there is styleless output, use the content of this variable and ignore the rest |
|
1446 | + if ($this->stylelessOutput != '') { |
|
1447 | + return $this->stylelessOutput; |
|
1448 | + } |
|
1449 | + |
|
1450 | + //if no stylePrefix is set, generate it yourself depending on the script name |
|
1451 | + if ($this->stylePrefix == '') { |
|
1452 | + $this->stylePrefix = str_replace('.', '_', $this->_generateFilename()) . '_'; |
|
1453 | + } |
|
1454 | + |
|
1455 | + //set an openInNewWindow_token_to be inserted or not |
|
1456 | + if ($this->openInNewWindow) { |
|
1457 | + $targetInsert = " target='_blank'"; |
|
1458 | + } |
|
1459 | + |
|
1460 | + // use this array to put the lines in and implode later with "document.write" javascript |
|
1461 | + $feedArray = array(); |
|
1462 | + if ($this->image != null) { |
|
1463 | + $imageStr = "<a href='" . $this->image->link . "'" . $targetInsert . '>' . "<img src='" . $this->image->url |
|
1464 | + . "' border='0' alt='" . FeedCreator::iTrunc(htmlspecialchars($this->image->title), 100) |
|
1465 | + . "' align='" . $this->imageAlign . "' "; |
|
1466 | + if ($this->image->width) { |
|
1467 | + $imageStr .= " width='" . $this->image->width . "' "; |
|
1468 | + } |
|
1469 | + if ($this->image->height) { |
|
1470 | + $imageStr .= " height='" . $this->image->height . "' "; |
|
1471 | + } |
|
1472 | + $imageStr .= '/></a>'; |
|
1473 | + $feedArray[] = $imageStr; |
|
1474 | + } |
|
1475 | + |
|
1476 | + if ($this->title) { |
|
1477 | + $feedArray[] = "<div class='" . $this->stylePrefix . "title'><a href='" . $this->link . "' " . $targetInsert |
|
1478 | + . " class='" . $this->stylePrefix . "title'>" |
|
1479 | + . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . '</a></div>'; |
|
1480 | + } |
|
1481 | + if ($this->getDescription()) { |
|
1482 | + $feedArray[] = "<div class='" . $this->stylePrefix . "description'>" . str_replace(']]>', '', |
|
1483 | + str_replace('<![CDATA[', |
|
1484 | + '', |
|
1485 | + $this->getDescription())) |
|
1486 | + . '</div>'; |
|
1487 | + } |
|
1488 | + |
|
1489 | + if ($this->header) { |
|
1490 | + $feedArray[] = "<div class='" . $this->stylePrefix . "header'>" . $this->header . '</div>'; |
|
1491 | + } |
|
1492 | + |
|
1493 | + for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
1494 | + if ($this->separator && $i > 0) { |
|
1495 | + $feedArray[] = "<div class='" . $this->stylePrefix . "separator'>" . $this->separator . '</div>'; |
|
1496 | + } |
|
1497 | + |
|
1498 | + if ($this->items[$i]->title) { |
|
1499 | + if ($this->items[$i]->link) { |
|
1500 | + $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'><a href='" |
|
1501 | + . $this->items[$i]->link . "' class='" . $this->stylePrefix . "item_title'" |
|
1502 | + . $targetInsert . '>' |
|
1503 | + . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1504 | + . '</a></div>'; |
|
1505 | + } else { |
|
1506 | + $feedArray[] = "<div class='" . $this->stylePrefix . "item_title'>" |
|
1507 | + . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) |
|
1508 | + . '</div>'; |
|
1509 | + } |
|
1510 | + } |
|
1511 | + if ($this->items[$i]->getDescription()) { |
|
1512 | + $feedArray[] = "<div class='" . $this->stylePrefix . "item_description'>" . str_replace(']]>', '', |
|
1513 | + str_replace('<![CDATA[', |
|
1514 | + '', |
|
1515 | + $this->items[$i]->getDescription())) |
|
1516 | + . '</div>'; |
|
1517 | + } |
|
1518 | + } |
|
1519 | + if ($this->footer) { |
|
1520 | + $feedArray[] = "<div class='" . $this->stylePrefix . "footer'>" . $this->footer . '</div>'; |
|
1521 | + } |
|
1522 | + |
|
1523 | + $feed = '' . implode($feedArray, "\r\n"); |
|
1524 | + |
|
1525 | + return $feed; |
|
1526 | + } |
|
1527 | + |
|
1528 | + /** |
|
1529 | + * Overrrides parent to produce .html extensions |
|
1530 | + * |
|
1531 | + * @return string the feed cache filename |
|
1532 | + * @since 1.4 |
|
1533 | + * @access private |
|
1534 | + */ |
|
1535 | + public function _generateFilename() { |
|
1536 | + $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1537 | + |
|
1538 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.html'; |
|
1539 | + } |
|
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | /** |
@@ -1547,36 +1547,36 @@ discard block |
||
1547 | 1547 | */ |
1548 | 1548 | class JSCreator extends HTMLCreator |
1549 | 1549 | { |
1550 | - public $contentType = 'text/javascript'; |
|
1551 | - |
|
1552 | - /** |
|
1553 | - * writes the javascript |
|
1554 | - * @return string the scripts's complete text |
|
1555 | - */ |
|
1556 | - public function createFeed() { |
|
1557 | - $feed = parent::createFeed(); |
|
1558 | - $feedArray = explode("\n", $feed); |
|
1559 | - |
|
1560 | - $jsFeed = ''; |
|
1561 | - foreach ($feedArray as $value) { |
|
1562 | - $jsFeed .= "document.write('" . trim(addslashes($value)) . "');\n"; |
|
1563 | - } |
|
1564 | - |
|
1565 | - return $jsFeed; |
|
1566 | - } |
|
1567 | - |
|
1568 | - /** |
|
1569 | - * Overrrides parent to produce .js extensions |
|
1570 | - * |
|
1571 | - * @return string the feed cache filename |
|
1572 | - * @since 1.4 |
|
1573 | - * @access private |
|
1574 | - */ |
|
1575 | - public function _generateFilename() { |
|
1576 | - $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1577 | - |
|
1578 | - return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.js'; |
|
1579 | - } |
|
1550 | + public $contentType = 'text/javascript'; |
|
1551 | + |
|
1552 | + /** |
|
1553 | + * writes the javascript |
|
1554 | + * @return string the scripts's complete text |
|
1555 | + */ |
|
1556 | + public function createFeed() { |
|
1557 | + $feed = parent::createFeed(); |
|
1558 | + $feedArray = explode("\n", $feed); |
|
1559 | + |
|
1560 | + $jsFeed = ''; |
|
1561 | + foreach ($feedArray as $value) { |
|
1562 | + $jsFeed .= "document.write('" . trim(addslashes($value)) . "');\n"; |
|
1563 | + } |
|
1564 | + |
|
1565 | + return $jsFeed; |
|
1566 | + } |
|
1567 | + |
|
1568 | + /** |
|
1569 | + * Overrrides parent to produce .js extensions |
|
1570 | + * |
|
1571 | + * @return string the feed cache filename |
|
1572 | + * @since 1.4 |
|
1573 | + * @access private |
|
1574 | + */ |
|
1575 | + public function _generateFilename() { |
|
1576 | + $fileInfo = pathinfo($_SERVER['PHP_SELF']); |
|
1577 | + |
|
1578 | + return substr($fileInfo['basename'], 0, -(strlen($fileInfo['extension']) + 1)) . '.js'; |
|
1579 | + } |
|
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | /*** TEST SCRIPT ********************************************************* |
@@ -27,10 +27,10 @@ |
||
27 | 27 | include __DIR__ . '/header.php'; |
28 | 28 | $article_id = empty($_GET['article']) ? 0 : (int)$_GET['article']; |
29 | 29 | if (empty($article_id)) { |
30 | - return; |
|
30 | + return; |
|
31 | 31 | } |
32 | 32 | if (planet_getcookie('art_' . $article_id) > 0) { |
33 | - return; |
|
33 | + return; |
|
34 | 34 | } |
35 | 35 | $article_handler = xoops_getModuleHandler('article', $xoopsModule->getVar('dirname')); |
36 | 36 | $article_obj =& $article_handler->get($article_id); |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | */ |
34 | 34 | if (preg_match("/(\/comment_[^\.]*\.php\?.*=.*)/i", $_SERVER['REQUEST_URI'], $matches)) { |
35 | - header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]); |
|
36 | - exit(); |
|
35 | + header('location: ' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . $matches[1]); |
|
36 | + exit(); |
|
37 | 37 | } |
38 | 38 | if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) { |
39 | - include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
40 | - exit(); |
|
39 | + include XOOPS_ROOT_PATH . '/include/notification_update.php'; |
|
40 | + exit(); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ($REQUEST_URI_parsed = planet_parse_args($args_num, $args, $args_str)) { |
44 | - $args['article'] = @$args_num[0]; |
|
45 | - $args['blog'] = @$args['blog']; |
|
44 | + $args['article'] = @$args_num[0]; |
|
45 | + $args['blog'] = @$args['blog']; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | |
56 | 56 | // restore $_SERVER['REQUEST_URI'] |
57 | 57 | if (!empty($REQUEST_URI_parsed)) { |
58 | - $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
59 | - . (empty($article_id) ? '' : '?article=' . $article_id); |
|
58 | + $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
59 | + . (empty($article_id) ? '' : '?article=' . $article_id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . $article_obj->getVar('art_title'); |
@@ -65,32 +65,32 @@ discard block |
||
65 | 65 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
66 | 66 | |
67 | 67 | $article_data = array( |
68 | - 'id' => $article_id, |
|
69 | - 'title' => $article_obj->getVar('art_title'), |
|
70 | - 'content' => $article_obj->getVar('art_content'), |
|
71 | - 'author' => $article_obj->getVar('art_author'), |
|
72 | - 'time' => $article_obj->getTime(), |
|
73 | - 'link' => $article_obj->getVar('art_link'), |
|
74 | - 'views' => $article_obj->getVar('art_views'), |
|
75 | - 'comments' => $article_obj->getVar('art_comments'), |
|
76 | - 'star' => $article_obj->getStar(), |
|
77 | - 'rates' => $article_obj->getVar('art_rates'), |
|
78 | - 'blog' => array('id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')) |
|
68 | + 'id' => $article_id, |
|
69 | + 'title' => $article_obj->getVar('art_title'), |
|
70 | + 'content' => $article_obj->getVar('art_content'), |
|
71 | + 'author' => $article_obj->getVar('art_author'), |
|
72 | + 'time' => $article_obj->getTime(), |
|
73 | + 'link' => $article_obj->getVar('art_link'), |
|
74 | + 'views' => $article_obj->getVar('art_views'), |
|
75 | + 'comments' => $article_obj->getVar('art_comments'), |
|
76 | + 'star' => $article_obj->getStar(), |
|
77 | + 'rates' => $article_obj->getVar('art_rates'), |
|
78 | + 'blog' => array('id' => $article_obj->getVar('blog_id'), 'title' => $blog_obj->getVar('blog_title')) |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | if (!empty($xoopsModuleConfig['do_sibling'])) { |
82 | - $articles_sibling =& $article_handler->getSibling($article_obj, $blog_id); |
|
83 | - if (!empty($articles_sibling['previous'])) { |
|
84 | - $articles_sibling['previous']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
85 | - . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' |
|
86 | - . $blog_id; |
|
87 | - $articles_sibling['previous']['title'] = $articles_sibling['previous']['title']; |
|
88 | - } |
|
89 | - if (!empty($articles_sibling['next'])) { |
|
90 | - $articles_sibling['next']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
91 | - . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id; |
|
92 | - $articles_sibling['next']['title'] = $articles_sibling['next']['title']; |
|
93 | - } |
|
82 | + $articles_sibling =& $article_handler->getSibling($article_obj, $blog_id); |
|
83 | + if (!empty($articles_sibling['previous'])) { |
|
84 | + $articles_sibling['previous']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
85 | + . URL_DELIMITER . '' . $articles_sibling['previous']['id'] . '/b' |
|
86 | + . $blog_id; |
|
87 | + $articles_sibling['previous']['title'] = $articles_sibling['previous']['title']; |
|
88 | + } |
|
89 | + if (!empty($articles_sibling['next'])) { |
|
90 | + $articles_sibling['next']['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' |
|
91 | + . URL_DELIMITER . '' . $articles_sibling['next']['id'] . '/b' . $blog_id; |
|
92 | + $articles_sibling['next']['title'] = $articles_sibling['next']['title']; |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $xoopsTpl->assign('modulename', $xoopsModule->getVar('name')); |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1)); |
102 | 102 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
103 | 103 | } else { |
104 | - $xoopsTpl->assign('canrate', 1); |
|
104 | + $xoopsTpl->assign('canrate', 1); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | if ($transferbar = @include XOOPS_ROOT_PATH . '/Frameworks/transfer/bar.transfer.php') { |
108 | - $xoopsTpl->assign('transfer', $transferbar); |
|
108 | + $xoopsTpl->assign('transfer', $transferbar); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Loading module meta data, NOT THE RIGHT WAY DOING IT |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $config_handler = xoops_getHandler('config'); |
32 | 32 | $xoopsConfigSearch =& $config_handler->getConfigsByCat(XOOPS_CONF_SEARCH); |
33 | 33 | if (empty($xoopsConfigSearch['enable_search'])) { |
34 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS')); |
|
34 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; |
@@ -49,92 +49,92 @@ discard block |
||
49 | 49 | $blog = (int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null)); |
50 | 50 | $uid = (int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null)); |
51 | 51 | $searchin = isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', |
52 | - $_GET['searchin']) : array()); |
|
52 | + $_GET['searchin']) : array()); |
|
53 | 53 | $sortby = isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null); |
54 | 54 | $term = isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : ''); |
55 | 55 | |
56 | 56 | $andor = in_array(strtoupper($andor), array('OR', 'AND', 'EXACT')) ? strtoupper($andor) : 'OR'; |
57 | 57 | $sortby = in_array(strtolower($sortby), array( |
58 | - 'a.art_id desc', |
|
59 | - 'a.art_time desc', |
|
60 | - 'a.art_title', |
|
61 | - 'a.blog_id', |
|
62 | - 'b.blog_id', |
|
63 | - 'b.blog_feed', |
|
64 | - 'b.blog_title', |
|
65 | - 'b.blog_time' |
|
58 | + 'a.art_id desc', |
|
59 | + 'a.art_time desc', |
|
60 | + 'a.art_title', |
|
61 | + 'a.blog_id', |
|
62 | + 'b.blog_id', |
|
63 | + 'b.blog_feed', |
|
64 | + 'b.blog_title', |
|
65 | + 'b.blog_time' |
|
66 | 66 | )) ? strtolower($sortby) : ''; |
67 | 67 | |
68 | 68 | if (!(empty($_POST['submit']) && empty($_GET['term']))) { |
69 | - $next_search['category'] = $category; |
|
70 | - $next_search['blog'] = $blog; |
|
71 | - $next_search['uid'] = $uid; |
|
72 | - $next_search['andor'] = $andor; |
|
69 | + $next_search['category'] = $category; |
|
70 | + $next_search['blog'] = $blog; |
|
71 | + $next_search['uid'] = $uid; |
|
72 | + $next_search['andor'] = $andor; |
|
73 | 73 | |
74 | - $next_search['term'] = $term; |
|
75 | - $query = trim($term); |
|
74 | + $next_search['term'] = $term; |
|
75 | + $query = trim($term); |
|
76 | 76 | |
77 | - if ($andor !== 'EXACT') { |
|
78 | - $ignored_queries = array(); // holds kewords that are shorter than allowed minmum length |
|
79 | - $temp_queries = preg_split("/[\s,]+/", $query); |
|
80 | - foreach ($temp_queries as $q) { |
|
81 | - $q = trim($q); |
|
82 | - if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
83 | - $queries[] = $myts->addSlashes($q); |
|
84 | - } else { |
|
85 | - $ignored_queries[] = $myts->addSlashes($q); |
|
86 | - } |
|
87 | - } |
|
88 | - if (count($queries) == 0) { |
|
89 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, |
|
90 | - sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
91 | - } |
|
92 | - } else { |
|
93 | - if (strlen($query) < $xoopsConfigSearch['keyword_min']) { |
|
94 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, |
|
95 | - sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
96 | - } |
|
97 | - $queries = array($myts->addSlashes($query)); |
|
98 | - } |
|
77 | + if ($andor !== 'EXACT') { |
|
78 | + $ignored_queries = array(); // holds kewords that are shorter than allowed minmum length |
|
79 | + $temp_queries = preg_split("/[\s,]+/", $query); |
|
80 | + foreach ($temp_queries as $q) { |
|
81 | + $q = trim($q); |
|
82 | + if (strlen($q) >= $xoopsConfigSearch['keyword_min']) { |
|
83 | + $queries[] = $myts->addSlashes($q); |
|
84 | + } else { |
|
85 | + $ignored_queries[] = $myts->addSlashes($q); |
|
86 | + } |
|
87 | + } |
|
88 | + if (count($queries) == 0) { |
|
89 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, |
|
90 | + sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
91 | + } |
|
92 | + } else { |
|
93 | + if (strlen($query) < $xoopsConfigSearch['keyword_min']) { |
|
94 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, |
|
95 | + sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min'])); |
|
96 | + } |
|
97 | + $queries = array($myts->addSlashes($query)); |
|
98 | + } |
|
99 | 99 | |
100 | - $next_search['sortby'] = $sortby; |
|
101 | - $next_search['searchin'] = implode('|', $searchin); |
|
100 | + $next_search['sortby'] = $sortby; |
|
101 | + $next_search['searchin'] = implode('|', $searchin); |
|
102 | 102 | |
103 | - /* To be added: year-month |
|
103 | + /* To be added: year-month |
|
104 | 104 | * see view.archive.php |
105 | 105 | */ |
106 | - if (!empty($time)) { |
|
107 | - $extra = ''; |
|
108 | - } else { |
|
109 | - $extra = ''; |
|
110 | - } |
|
106 | + if (!empty($time)) { |
|
107 | + $extra = ''; |
|
108 | + } else { |
|
109 | + $extra = ''; |
|
110 | + } |
|
111 | 111 | |
112 | - $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra); |
|
112 | + $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra); |
|
113 | 113 | |
114 | - /* |
|
114 | + /* |
|
115 | 115 | if ( count($results) < 1 ) { |
116 | 116 | redirect_header("javascript:history.go(-1);", 2, _SR_NOMATCH); |
117 | 117 | } else |
118 | 118 | */ |
119 | - { |
|
120 | - $xoopsTpl->assign('results', $results); |
|
119 | + { |
|
120 | + $xoopsTpl->assign('results', $results); |
|
121 | 121 | |
122 | - if (count($next_search) > 0) { |
|
123 | - $items = array(); |
|
124 | - foreach ($next_search as $para => $val) { |
|
125 | - if (!empty($val)) { |
|
126 | - $items[] = "$para=$val"; |
|
127 | - } |
|
128 | - } |
|
129 | - if (count($items) > 0) { |
|
130 | - $paras = implode('&', $items); |
|
131 | - } |
|
132 | - unset($next_search); |
|
133 | - unset($items); |
|
134 | - } |
|
135 | - $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras; |
|
122 | + if (count($next_search) > 0) { |
|
123 | + $items = array(); |
|
124 | + foreach ($next_search as $para => $val) { |
|
125 | + if (!empty($val)) { |
|
126 | + $items[] = "$para=$val"; |
|
127 | + } |
|
128 | + } |
|
129 | + if (count($items) > 0) { |
|
130 | + $paras = implode('&', $items); |
|
131 | + } |
|
132 | + unset($next_search); |
|
133 | + unset($items); |
|
134 | + } |
|
135 | + $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras; |
|
136 | 136 | |
137 | - /* |
|
137 | + /* |
|
138 | 138 | $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra); |
139 | 139 | $next_count = count($next_results); |
140 | 140 | $has_next = false; |
@@ -143,41 +143,41 @@ discard block |
||
143 | 143 | } |
144 | 144 | if (false != $has_next) |
145 | 145 | */ |
146 | - if (count($results)) { |
|
147 | - $next = $start + $limit; |
|
148 | - $queries = implode(',', $queries); |
|
149 | - $search_url_next = $search_url . "&start=$next"; |
|
150 | - $search_next = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>'; |
|
151 | - $xoopsTpl->assign('search_next', $search_next); |
|
152 | - } |
|
153 | - if ($start > 0) { |
|
154 | - $prev = $start - $limit; |
|
155 | - $search_url_prev = $search_url . "&start=$prev"; |
|
156 | - $search_prev = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>'; |
|
157 | - $xoopsTpl->assign('search_prev', $search_prev); |
|
158 | - } |
|
159 | - } |
|
146 | + if (count($results)) { |
|
147 | + $next = $start + $limit; |
|
148 | + $queries = implode(',', $queries); |
|
149 | + $search_url_next = $search_url . "&start=$next"; |
|
150 | + $search_next = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>'; |
|
151 | + $xoopsTpl->assign('search_next', $search_next); |
|
152 | + } |
|
153 | + if ($start > 0) { |
|
154 | + $prev = $start - $limit; |
|
155 | + $search_url_prev = $search_url . "&start=$prev"; |
|
156 | + $search_prev = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>'; |
|
157 | + $xoopsTpl->assign('search_prev', $search_prev); |
|
158 | + } |
|
159 | + } |
|
160 | 160 | |
161 | - unset($results); |
|
162 | - $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term); |
|
163 | - $xoopsTpl->assign('search_info', $search_info); |
|
161 | + unset($results); |
|
162 | + $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term); |
|
163 | + $xoopsTpl->assign('search_info', $search_info); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /* type */ |
167 | 167 | $type_select = "<select name=\"andor\">"; |
168 | 168 | $type_select .= "<option value=\"OR\""; |
169 | 169 | if ('OR' === $andor) { |
170 | - $type_select .= " selected=\"selected\""; |
|
170 | + $type_select .= " selected=\"selected\""; |
|
171 | 171 | } |
172 | 172 | $type_select .= '>' . _SR_ANY . '</option>'; |
173 | 173 | $type_select .= "<option value=\"AND\""; |
174 | 174 | if ('AND' === $andor) { |
175 | - $type_select .= " selected=\"selected\""; |
|
175 | + $type_select .= " selected=\"selected\""; |
|
176 | 176 | } |
177 | 177 | $type_select .= '>' . _SR_ALL . '</option>'; |
178 | 178 | $type_select .= "<option value=\"EXACT\""; |
179 | 179 | if ('exact' === $andor) { |
180 | - $type_select .= " selected=\"selected\""; |
|
180 | + $type_select .= " selected=\"selected\""; |
|
181 | 181 | } |
182 | 182 | $type_select .= '>' . _SR_EXACT . '</option>'; |
183 | 183 | $type_select .= '</select>'; |
@@ -186,32 +186,32 @@ discard block |
||
186 | 186 | $searchin_select = ''; |
187 | 187 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"title\""; |
188 | 188 | if (in_array('title', $searchin)) { |
189 | - $searchin_select .= ' checked'; |
|
189 | + $searchin_select .= ' checked'; |
|
190 | 190 | } |
191 | 191 | $searchin_select .= ' />' . planet_constant('MD_TITLE') . ' '; |
192 | 192 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\""; |
193 | 193 | if (in_array('text', $searchin)) { |
194 | - $searchin_select .= ' checked'; |
|
194 | + $searchin_select .= ' checked'; |
|
195 | 195 | } |
196 | 196 | $searchin_select .= ' />' . planet_constant('MD_BODY') . ' || '; |
197 | 197 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\""; |
198 | 198 | if (in_array('blog', $searchin)) { |
199 | - $searchin_select .= ' checked'; |
|
199 | + $searchin_select .= ' checked'; |
|
200 | 200 | } |
201 | 201 | $searchin_select .= ' />' . planet_constant('MD_BLOG') . ' '; |
202 | 202 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\""; |
203 | 203 | if (in_array('feed', $searchin)) { |
204 | - $searchin_select .= ' checked'; |
|
204 | + $searchin_select .= ' checked'; |
|
205 | 205 | } |
206 | 206 | $searchin_select .= ' />' . planet_constant('MD_FEED') . ' '; |
207 | 207 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\""; |
208 | 208 | if (in_array('desc', $searchin)) { |
209 | - $searchin_select .= ' checked'; |
|
209 | + $searchin_select .= ' checked'; |
|
210 | 210 | } |
211 | 211 | $searchin_select .= ' />' . planet_constant('MD_DESC') . ' '; |
212 | 212 | $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\""; |
213 | 213 | if (empty($searchin)) { |
214 | - $searchin_select .= ' checked'; |
|
214 | + $searchin_select .= ' checked'; |
|
215 | 215 | } |
216 | 216 | $searchin_select .= ' />' . _ALL . ' '; |
217 | 217 | |
@@ -219,28 +219,28 @@ discard block |
||
219 | 219 | $sortby_select = "<select name=\"sortby\">"; |
220 | 220 | $sortby_select .= "<option value=\"\""; |
221 | 221 | if (empty($sortby)) { |
222 | - $sortby_select .= " selected=\"selected\""; |
|
222 | + $sortby_select .= " selected=\"selected\""; |
|
223 | 223 | } |
224 | 224 | $sortby_select .= '>' . _NONE . '</option>'; |
225 | 225 | $sortby_select .= "<option value=\"a.art_time\""; |
226 | 226 | if ('a.art_time' === $sortby) { |
227 | - $sortby_select .= " selected=\"selected\""; |
|
227 | + $sortby_select .= " selected=\"selected\""; |
|
228 | 228 | } |
229 | 229 | $sortby_select .= '>' . planet_constant('MD_TIME') . '</option>'; |
230 | 230 | $sortby_select .= "<option value=\"a.art_title\""; |
231 | 231 | if ('a.art_title' === $sortby) { |
232 | - $sortby_select .= " selected=\"selected\""; |
|
232 | + $sortby_select .= " selected=\"selected\""; |
|
233 | 233 | } |
234 | 234 | $sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>'; |
235 | 235 | $sortby_select .= "<option value=\"\"> ---- </option>"; |
236 | 236 | $sortby_select .= "<option value=\"a.blog_title\""; |
237 | 237 | if ('a.blog_title' === $sortby) { |
238 | - $sortby_select .= " selected=\"selected\""; |
|
238 | + $sortby_select .= " selected=\"selected\""; |
|
239 | 239 | } |
240 | 240 | $sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>'; |
241 | 241 | $sortby_select .= "<option value=\"a.blog_time\""; |
242 | 242 | if ('b.blog_time' === $sortby) { |
243 | - $sortby_select .= " selected=\"selected\""; |
|
243 | + $sortby_select .= " selected=\"selected\""; |
|
244 | 244 | } |
245 | 245 | $sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>'; |
246 | 246 | $sortby_select .= '</select>'; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $xoopsTpl->assign('uid', $uid); |
258 | 258 | |
259 | 259 | if ($xoopsConfigSearch['keyword_min'] > 0) { |
260 | - $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
260 | + $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min'])); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | include __DIR__ . '/include/vars.php'; |
31 | 31 | |
32 | 32 | $modversion = array( |
33 | - 'name' => planet_constant('MI_NAME'), |
|
34 | - 'version' => 2.10, |
|
35 | - 'description' => planet_constant('MI_DESC'), |
|
36 | - 'credits' => 'XOOPS Project', |
|
37 | - 'image' => 'assets/images/logoModule.png', |
|
38 | - 'dirname' => $GLOBALS['moddirname'], |
|
39 | - 'author' => 'D.J. (phppp)', |
|
40 | - 'help' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html' |
|
33 | + 'name' => planet_constant('MI_NAME'), |
|
34 | + 'version' => 2.10, |
|
35 | + 'description' => planet_constant('MI_DESC'), |
|
36 | + 'credits' => 'XOOPS Project', |
|
37 | + 'image' => 'assets/images/logoModule.png', |
|
38 | + 'dirname' => $GLOBALS['moddirname'], |
|
39 | + 'author' => 'D.J. (phppp)', |
|
40 | + 'help' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html' |
|
41 | 41 | ); |
42 | 42 | $modversion['help'] = 'page=help'; |
43 | 43 | $modversion['license'] = 'GNU see LICENSE'; |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | $modversion['min_xoops'] = '2.5.8'; |
58 | 58 | $modversion['min_admin'] = '1.2'; |
59 | 59 | $modversion['min_db'] = array( |
60 | - 'mysql' => '5.0.7', |
|
61 | - 'mysqli' => '5.0.7' |
|
60 | + 'mysql' => '5.0.7', |
|
61 | + 'mysqli' => '5.0.7' |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // database tables |
65 | 65 | $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; |
66 | 66 | $modversion['tables'] = array( |
67 | - $GLOBALS['MOD_DB_PREFIX'] . '_category', |
|
68 | - $GLOBALS['MOD_DB_PREFIX'] . '_article', |
|
69 | - $GLOBALS['MOD_DB_PREFIX'] . '_blog', |
|
70 | - $GLOBALS['MOD_DB_PREFIX'] . '_blogcat', |
|
71 | - $GLOBALS['MOD_DB_PREFIX'] . '_bookmark', |
|
72 | - $GLOBALS['MOD_DB_PREFIX'] . '_rate' |
|
67 | + $GLOBALS['MOD_DB_PREFIX'] . '_category', |
|
68 | + $GLOBALS['MOD_DB_PREFIX'] . '_article', |
|
69 | + $GLOBALS['MOD_DB_PREFIX'] . '_blog', |
|
70 | + $GLOBALS['MOD_DB_PREFIX'] . '_blogcat', |
|
71 | + $GLOBALS['MOD_DB_PREFIX'] . '_bookmark', |
|
72 | + $GLOBALS['MOD_DB_PREFIX'] . '_rate' |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | // Admin things |
@@ -151,162 +151,162 @@ discard block |
||
151 | 151 | // Configs |
152 | 152 | // Config items |
153 | 153 | $modversion['config'][] = array( |
154 | - 'name' => 'do_debug', |
|
155 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG', |
|
156 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC', |
|
157 | - 'formtype' => 'yesno', |
|
158 | - 'valuetype' => 'int', |
|
159 | - 'default' => 1 |
|
154 | + 'name' => 'do_debug', |
|
155 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG', |
|
156 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC', |
|
157 | + 'formtype' => 'yesno', |
|
158 | + 'valuetype' => 'int', |
|
159 | + 'default' => 1 |
|
160 | 160 | ); |
161 | 161 | |
162 | 162 | $modversion['config'][] = array( |
163 | - 'name' => 'do_urw', |
|
164 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE', |
|
165 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC', |
|
166 | - 'formtype' => 'yesno', |
|
167 | - 'valuetype' => 'int', |
|
168 | - 'default' => in_array(php_sapi_name(), array('apache', 'apache2handler')) |
|
163 | + 'name' => 'do_urw', |
|
164 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE', |
|
165 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC', |
|
166 | + 'formtype' => 'yesno', |
|
167 | + 'valuetype' => 'int', |
|
168 | + 'default' => in_array(php_sapi_name(), array('apache', 'apache2handler')) |
|
169 | 169 | ); |
170 | 170 | |
171 | 171 | $modversion['config'][] = array( |
172 | - 'name' => 'theme_set', |
|
173 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET', |
|
174 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC', |
|
175 | - 'formtype' => 'select', |
|
176 | - 'valuetype' => 'text', |
|
177 | - 'options' => array(_NONE => '0'), |
|
178 | - 'default' => '' |
|
172 | + 'name' => 'theme_set', |
|
173 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET', |
|
174 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC', |
|
175 | + 'formtype' => 'select', |
|
176 | + 'valuetype' => 'text', |
|
177 | + 'options' => array(_NONE => '0'), |
|
178 | + 'default' => '' |
|
179 | 179 | ); |
180 | 180 | |
181 | 181 | $modversion['config'][] = array( |
182 | - 'name' => 'timeformat', |
|
183 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT', |
|
184 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC', |
|
185 | - 'formtype' => 'select', |
|
186 | - 'valuetype' => 'text', |
|
187 | - 'options' => array( |
|
188 | - _DATESTRING => 'l', |
|
189 | - _MEDIUMDATESTRING => 'm', |
|
190 | - _SHORTDATESTRING => 's', |
|
191 | - $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
192 | - ), |
|
193 | - 'default' => 'c' |
|
182 | + 'name' => 'timeformat', |
|
183 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT', |
|
184 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC', |
|
185 | + 'formtype' => 'select', |
|
186 | + 'valuetype' => 'text', |
|
187 | + 'options' => array( |
|
188 | + _DATESTRING => 'l', |
|
189 | + _MEDIUMDATESTRING => 'm', |
|
190 | + _SHORTDATESTRING => 's', |
|
191 | + $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
192 | + ), |
|
193 | + 'default' => 'c' |
|
194 | 194 | ); |
195 | 195 | |
196 | 196 | $modversion['config'][] = array( |
197 | - 'name' => 'articles_perpage', |
|
198 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE', |
|
199 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC', |
|
200 | - 'formtype' => 'textbox', |
|
201 | - 'valuetype' => 'int', |
|
202 | - 'default' => 10 |
|
197 | + 'name' => 'articles_perpage', |
|
198 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE', |
|
199 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC', |
|
200 | + 'formtype' => 'textbox', |
|
201 | + 'valuetype' => 'int', |
|
202 | + 'default' => 10 |
|
203 | 203 | ); |
204 | 204 | |
205 | 205 | $modversion['config'][] = array( |
206 | - 'name' => 'list_perpage', |
|
207 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE', |
|
208 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC', |
|
209 | - 'formtype' => 'textbox', |
|
210 | - 'valuetype' => 'int', |
|
211 | - 'default' => 20 |
|
206 | + 'name' => 'list_perpage', |
|
207 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE', |
|
208 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC', |
|
209 | + 'formtype' => 'textbox', |
|
210 | + 'valuetype' => 'int', |
|
211 | + 'default' => 20 |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | $modversion['config'][] = array( |
215 | - 'name' => 'blogs_perupdate', |
|
216 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE', |
|
217 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC', |
|
218 | - 'formtype' => 'textbox', |
|
219 | - 'valuetype' => 'int', |
|
220 | - 'default' => 10 |
|
215 | + 'name' => 'blogs_perupdate', |
|
216 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE', |
|
217 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC', |
|
218 | + 'formtype' => 'textbox', |
|
219 | + 'valuetype' => 'int', |
|
220 | + 'default' => 10 |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | $modversion['config'][] = array( |
224 | - 'name' => 'article_expire', |
|
225 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE', |
|
226 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC', |
|
227 | - 'formtype' => 'textbox', |
|
228 | - 'valuetype' => 'int', |
|
229 | - 'default' => 30 |
|
224 | + 'name' => 'article_expire', |
|
225 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE', |
|
226 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC', |
|
227 | + 'formtype' => 'textbox', |
|
228 | + 'valuetype' => 'int', |
|
229 | + 'default' => 30 |
|
230 | 230 | ); |
231 | 231 | |
232 | 232 | $modversion['config'][] = array( |
233 | - 'name' => 'display_summary', |
|
234 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY', |
|
235 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC', |
|
236 | - 'formtype' => 'textbox', |
|
237 | - 'valuetype' => 'int', |
|
238 | - 'default' => 0 |
|
233 | + 'name' => 'display_summary', |
|
234 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY', |
|
235 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC', |
|
236 | + 'formtype' => 'textbox', |
|
237 | + 'valuetype' => 'int', |
|
238 | + 'default' => 0 |
|
239 | 239 | ); |
240 | 240 | |
241 | 241 | $modversion['config'][] = array( |
242 | - 'name' => 'do_sibling', |
|
243 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING', |
|
244 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC', |
|
245 | - 'formtype' => 'yesno', |
|
246 | - 'valuetype' => 'int', |
|
247 | - 'default' => 1 |
|
242 | + 'name' => 'do_sibling', |
|
243 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING', |
|
244 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC', |
|
245 | + 'formtype' => 'yesno', |
|
246 | + 'valuetype' => 'int', |
|
247 | + 'default' => 1 |
|
248 | 248 | ); |
249 | 249 | |
250 | 250 | $modversion['config'][] = array( |
251 | - 'name' => 'pings', |
|
252 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING', |
|
253 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC', |
|
254 | - 'formtype' => 'textarea', |
|
255 | - 'valuetype' => 'text', |
|
256 | - 'default' => '' |
|
251 | + 'name' => 'pings', |
|
252 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING', |
|
253 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC', |
|
254 | + 'formtype' => 'textarea', |
|
255 | + 'valuetype' => 'text', |
|
256 | + 'default' => '' |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | $modversion['config'][] = array( |
260 | - 'name' => 'trackback_option', |
|
261 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION', |
|
262 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC', |
|
263 | - 'formtype' => 'select', |
|
264 | - 'valuetype' => 'int', |
|
265 | - 'default' => 0, |
|
266 | - 'options' => array(planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2) |
|
260 | + 'name' => 'trackback_option', |
|
261 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION', |
|
262 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC', |
|
263 | + 'formtype' => 'select', |
|
264 | + 'valuetype' => 'int', |
|
265 | + 'default' => 0, |
|
266 | + 'options' => array(planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2) |
|
267 | 267 | ); |
268 | 268 | |
269 | 269 | $modversion['config'][] = array( |
270 | - 'name' => 'copyright', |
|
271 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT', |
|
272 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC', |
|
273 | - 'formtype' => 'textbox', |
|
274 | - 'valuetype' => 'text', |
|
275 | - 'default' => 'Copyright© %s & ' . $xoopsConfig['sitename'] |
|
270 | + 'name' => 'copyright', |
|
271 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT', |
|
272 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC', |
|
273 | + 'formtype' => 'textbox', |
|
274 | + 'valuetype' => 'text', |
|
275 | + 'default' => 'Copyright© %s & ' . $xoopsConfig['sitename'] |
|
276 | 276 | ); |
277 | 277 | |
278 | 278 | $modversion['config'][] = array( |
279 | - 'name' => 'newblog_submit', |
|
280 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT', |
|
281 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC', |
|
282 | - 'formtype' => 'select', |
|
283 | - 'valuetype' => 'int', |
|
284 | - 'default' => 2, |
|
285 | - 'options' => array( |
|
286 | - _NONE => 0, |
|
287 | - planet_constant('MI_MODERATION') => 1, |
|
288 | - planet_constant('MI_MEMBER') => 2, |
|
289 | - _ALL => 3 |
|
290 | - ) |
|
291 | - // 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all |
|
279 | + 'name' => 'newblog_submit', |
|
280 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT', |
|
281 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC', |
|
282 | + 'formtype' => 'select', |
|
283 | + 'valuetype' => 'int', |
|
284 | + 'default' => 2, |
|
285 | + 'options' => array( |
|
286 | + _NONE => 0, |
|
287 | + planet_constant('MI_MODERATION') => 1, |
|
288 | + planet_constant('MI_MEMBER') => 2, |
|
289 | + _ALL => 3 |
|
290 | + ) |
|
291 | + // 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all |
|
292 | 292 | ); |
293 | 293 | |
294 | 294 | $modversion['config'][] = array( |
295 | - 'name' => 'anonymous_rate', |
|
296 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE', |
|
297 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC', |
|
298 | - 'formtype' => 'yesno', |
|
299 | - 'valuetype' => 'int', |
|
300 | - 'default' => 0 |
|
295 | + 'name' => 'anonymous_rate', |
|
296 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE', |
|
297 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC', |
|
298 | + 'formtype' => 'yesno', |
|
299 | + 'valuetype' => 'int', |
|
300 | + 'default' => 0 |
|
301 | 301 | ); |
302 | 302 | |
303 | 303 | $modversion['config'][] = array( |
304 | - 'name' => 'do_pseudocron', |
|
305 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON', |
|
306 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC', |
|
307 | - 'formtype' => 'yesno', |
|
308 | - 'valuetype' => 'int', |
|
309 | - 'default' => 1 |
|
304 | + 'name' => 'do_pseudocron', |
|
305 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON', |
|
306 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC', |
|
307 | + 'formtype' => 'yesno', |
|
308 | + 'valuetype' => 'int', |
|
309 | + 'default' => 1 |
|
310 | 310 | ); |
311 | 311 | |
312 | 312 | // Notification |
@@ -32,9 +32,9 @@ |
||
32 | 32 | |
33 | 33 | // include the default language file for the admin interface |
34 | 34 | if (!@include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' |
35 | - . $xoopsConfig['language'] . '/main.php' |
|
35 | + . $xoopsConfig['language'] . '/main.php' |
|
36 | 36 | ) { |
37 | - include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/main.php'; |
|
37 | + include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/main.php'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | planet_define_url_delimiter(); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $pathLanguage = $path . $pathModuleAdmin; |
40 | 40 | |
41 | 41 | if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { |
42 | - $fileinc = $pathLanguage . '/language/english/main.php'; |
|
42 | + $fileinc = $pathLanguage . '/language/english/main.php'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | include_once $fileinc; |