Skip to content

Commit

Permalink
Switch to SCRIPT_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Apr 4, 2022
1 parent 65f2009 commit e4736a6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;

$rss->link = "http://www.dailyphp.net/news";
$rss->syndicationURL = "http://www.dailyphp.net/" . $_SERVER["PHP_SELF"];
$rss->syndicationURL = "http://www.dailyphp.net/" . $_SERVER["SCRIPT_NAME"];

$image = new FeedImage();
$image->title = "dailyphp.net logo";
Expand Down
10 changes: 5 additions & 5 deletions lib/Creator/FeedCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ protected function _createStylesheetReferences()
abstract public function createFeed();

/**
* Generate a filename for the feed cache file. The result will be $_SERVER["PHP_SELF"] with the extension changed
* to .xml. For example: echo $_SERVER["PHP_SELF"]."\n"; echo FeedCreator::_generateFilename(); would produce:
* Generate a filename for the feed cache file. The result will be $_SERVER["SCRIPT_NAME"] with the extension changed
* to .xml. For example: echo $_SERVER["SCRIPT_NAME"]."\n"; echo FeedCreator::_generateFilename(); would produce:
* /rss/latestnews.php
* latestnews.xml
*
Expand All @@ -182,7 +182,7 @@ abstract public function createFeed();
*/
protected function _generateFilename()
{
$fileInfo = pathinfo($_SERVER["PHP_SELF"]);
$fileInfo = pathinfo($_SERVER["SCRIPT_NAME"]);

return substr($fileInfo["basename"], 0, -(strlen($fileInfo["extension"]) + 1)).".xml";
}
Expand Down Expand Up @@ -227,7 +227,7 @@ protected function _redirect($filename)
*
* @since 1.4
* @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
* the filename is $_SERVER["SCRIPT_NAME"] with the extension changed to .xml (see
* _generateFilename()).
* @param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to
* 3600 = 1 hour)
Expand All @@ -249,7 +249,7 @@ public function useCached($filename = "", $timeout = 3600)
*
* @since 1.4
* @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
* specified, the filename is $_SERVER["SCRIPT_NAME"] with the extension changed to .xml
* (see _generateFilename()).
* @param bool $displayContents optional send an HTTP redirect header or not. If true, the user will be
* automatically redirected to the created file.
Expand Down
2 changes: 1 addition & 1 deletion lib/Creator/HTMLCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function createFeed()
*/
protected function _generateFilename()
{
$fileInfo = pathinfo($_SERVER["PHP_SELF"]);
$fileInfo = pathinfo($_SERVER["SCRIPT_NAME"]);

return substr($fileInfo["basename"], 0, -(strlen($fileInfo["extension"]) + 1)).".html";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Creator/JSCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function createFeed()
*/
protected function _generateFilename()
{
$fileInfo = pathinfo($_SERVER["PHP_SELF"]);
$fileInfo = pathinfo($_SERVER["SCRIPT_NAME"]);

return substr($fileInfo["basename"], 0, -(strlen($fileInfo["extension"]) + 1)).".js";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Creator/KMLCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function createFeed()
*/
protected function _generateFilename()
{
$fileInfo = pathinfo($_SERVER["PHP_SELF"]);
$fileInfo = pathinfo($_SERVER["SCRIPT_NAME"]);

return substr($fileInfo["basename"], 0, -(strlen($fileInfo["extension"]) + 1)).".kml";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Creator/MBOXCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function createFeed()
*/
protected function _generateFilename()
{
$fileInfo = pathinfo($_SERVER["PHP_SELF"]);
$fileInfo = pathinfo($_SERVER["SCRIPT_NAME"]);

return substr($fileInfo["basename"], 0, -(strlen($fileInfo["extension"]) + 1)).".mbox";
}
Expand Down
4 changes: 2 additions & 2 deletions lib/UniversalFeedCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function createFeed($format = "RSS0.91")
* "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM",
* "ATOM0.3", "HTML", "JS"
* @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
* specified, the filename is $_SERVER["SCRIPT_NAME"] with the extension changed to
* .xml (see _generateFilename()).
* @param boolean $displayContents optional send the content of the file or not. If true, the file will be sent
* in the body of the response.
Expand All @@ -147,7 +147,7 @@ public function saveFeed($format = "RSS0.91", $filename = "", $displayContents =
* @param string $format format the feed should comply to. Valid values are:
* "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3".
* @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
* filename is $_SERVER["SCRIPT_NAME"] with the extension changed to .xml (see
* _generateFilename()).
* @param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 =
* 1 hour)
Expand Down

0 comments on commit e4736a6

Please sign in to comment.