Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 17 → Rev 18

/trunk/.project
0,0 → 1,22
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PHPX</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
</projectDescription>
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/htmlencode.old.php
===================================================================
--- trunk/htmlencode.old.php (nonexistent)
+++ trunk/htmlencode.old.php (revision 18)
@@ -0,0 +1,117 @@
+/**
+ * Converts the argument to a visible (X)HTML hyperlink
+ * where its URI target is created from the argument.
+ * Supported are e-mail addresses, domain names with
+ * optional paths, and valid URIs.
+ *
+ * @param $text
+ * Argument to be converted.
+ * @return
+ * The converted argument if it applies to a supported
+ * scheme, the unconverted argument otherwise.
+ *
+ * @author (C) 2001-04-04T02:03
+ * mark.young@vdhinc.com at http://php.net/manual/en/ref.strings.php
+ *
+ * Minor correction to my HTMLEncode function.
+ *
+ * @author 2002-08-29T09:00
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Added target="_blank"
+ * - Added support for ftp(s)-URIs: (ht|f)
+ * - Added support for search strings (?...=...&...=...), either
+ * with or without HTML entities: \?=(&\w;|&)
+ * - Removed enclosing nl2br call because of preformatted display
+ *
+ * @author 2003-12-30T14:18
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Removed target="_blank".
+ * - Added PHPdoc.
+ *
+ * @author 2004-01-12T12:45
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Added support for #fragment_identifiers in URIs.
+ * - Added support for bugs and comments.
+ *
+ * @author 2004-01-13T01:29
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Added support for bug aliases.
+ *
+ * @author 2004-01-26T20:43
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Do not convert URIs in A elements.
+ * - Do not allow URIs with "&" before search-string.
+ * - camelCased function identifier. Only classes
+ * and constructors should start with uppercase.
+ *
+ * @author 2004-01-27T14:07
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Allow to convert URIs preceded by "&gt;" but not followed by "&lt;/a&gt;".
+ * - Allow ";" to be part of the search string
+ *
+ * @author 2004-01-29T14:10
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Require valid domain name for "bar" on conversion of "foo@bar" and
+ * "www.bar".
+ * - Be case-insensitive except of bug aliases
+ * - Escaped "-" in character classes if not meant as range metacharacter.
+ * - Corrected year.
+ *
+ * @author 2004-02-14T17:37
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Accept only valid Internet domain names
+ * - Accept "%" within path and query part (to escape ASCII characters)
+ *
+ * @author 2004-02-27T19:21
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Allow unescaped ":" in URI components, since it apparently does not
+ * "conflict with the reserved purpose" (RFC 2396, section 2.2.; here:
+ * scheme component)
+ * - Allow slashes, dots and dashes in URI components
+ * - Removed invalid [...(...|...)...]
+ *
+ * @author 2004-03-01T21:48
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Allow IPv4 addresses
+ *
+ * @author 2004-03-08T02:20
+ * Thomas Lahn &lt;PointedEars@selfhtml.de&gt; at localhost
+ *
+ * - Allow "+" and "," in query part
+ * - Optimized character classes
+ */
+function htmlEncode($text)
+{
+ $searcharray = array(
+ "'(?i)([\-_\w\d.]+@[\-\w\d.]+\.[A-Z]{2,})'i",
+ "'(?i)((?:(?!://).{3}|^.{0,2}))(www\.[\-\w\d.]+\.[A-Z]{2,}"
+ . "|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'i",
+ "'(?i)(?<!href=\")((ht|f)tps?:\/\/([\-\w\d.]+\.[A-Z]{2,}"
+ . "|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[#\-_~\w\d\.\/%]+"
+ . "(\?([%&+-;=\w])*)?(;[=\d\w])?)(?!</a>)'i",
+ "'(((?i)bug)\s+#?([\dA-Z_]+)\s+((?i)comment|Kommentar)\s+#?(\d+))'",
+ "'(((?i)bug)\s+#?([\dA-Z_]+))'",
+ "'(((?i)comment|Kommentar)\s+#?(\d+))'"
+ );
+
+ $replacearray = array(
+ "<a href=\"mailto:\\1\">\\1</a>",
+ "\\1http://\\2",
+ "<a href=\"\\1\">\\1</a>",
+ "<a href=\"./?bug=\\3#c\\5\">\\1</a>",
+ "<a href=\"./?bug=\\3#details\">\\1</a>",
+ "<a href=\"#c\\3\">\\1</a>"
+ );
+
+ return preg_replace($searcharray, $replacearray, $text);
+}
/trunk/htmlencode.old.php
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/.buildpath
===================================================================
--- trunk/.buildpath (nonexistent)
+++ trunk/.buildpath (revision 18)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path=""/>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>