                                                                                                                                                        


<?php
//-->-->-->-->-->-->-->-->
//--Name:
//--   fnSpecialLinkPlainText.php  
//--
//--Description:
//--   The purpose of this function is to insert HTML special links into a plain
//--
//--
//--See Also:
//--  fnMessageToHtml, fnJournalToHtml, 
//--  fnFaqToHtml, fnCvToHtml, fnDocumentToHtml
//--
//-- 
//--Author:
//--   matth3wbishop@yahoo.com
//--   http://www.geocities.com/matth3wbishop/



function fnSpecialLinkPlainText(
  $sPlainText, $sFilePath, $WEBPADWEBFOLDER)
{
  $sReturn = $sPlainText;

  $sFilePathEncoded = htmlspecialchars($sFilePath);
  $sFilePathUrlEncoded = htmlspecialchars(urlencode($sFilePath));

  $sSelfEditUrl = 
    "$WEBPADWEBFOLDER/webpad?file=$sFilePathUrlEncoded";

  //-- Hyperlink this format:
  //--   "Hyper-link display text" [self-edit-link]
  //-- This assumes that the double quote character " may have already been
  //-- 'entitized' by some previous code or other process.
  $sReturn = 
    preg_replace(
     '#\s(&quot;|"|\')(.+?)(&quot;|"|\')\s*\[self-edit-link\]#im', 
     " <a href='$sSelfEditUrl'>$2</a>", $sReturn);

  //-- Hyperlink this format:
  //--   "Hyper-link display text" ![self-edit-link]
  //-- This assumes that the double quote character " may have already been
  //-- 'entitized' by some previous code or other process.
  $sReturn = 
    preg_replace(
     '#\s(&quot;|"|\')(.+?)(&quot;|"|\')\s*!\[self-edit-link\]#im', 
     " <a href='$sSelfEditUrl' target = '_blank'>$2</a>", $sReturn);




  return $sReturn;
} //-- function fnSpecialLinkPlainText
     

//--<--<--<--<--<--<--<--<
?>
                                                                                                                                                        