Permalink
Browse files

added PHP encoder from Tim Akinbo - http://timakinbo.com/

git-svn-id: https://nbio.googlecode.com/svn/csshttprequest/trunk@63 e77911d0-6a52-0410-bea1-fbff64990c85
  • Loading branch information...
1 parent bf63431 commit 03feccc6f5463b1abf4bc8081a9844b70bc56dba shaderlab@gmail.com committed Nov 12, 2008
Showing with 27 additions and 2 deletions.
  1. +2 −2 csshttprequest.tmproj
  2. +25 −0 php/csshttprequest.php
View
@@ -44,12 +44,12 @@
</dict>
</array>
<key>fileHierarchyDrawerWidth</key>
- <integer>158</integer>
+ <integer>167</integer>
<key>metaData</key>
<dict/>
<key>showFileHierarchyDrawer</key>
<true/>
<key>windowFrame</key>
- <string>{{391, 78}, {799, 677}}</string>
+ <string>{{433, 67}, {799, 677}}</string>
</dict>
</plist>
View
@@ -0,0 +1,25 @@
+<?php
+/**
+ * CSSHttpRequest PHP Encoder 1.0
+ *
+ * @author Tim Akinbo <obnika@timakinbo.com>
+ * @version 1.0
+ * @license http://www.apache.org/licenses/LICENSE-2.0.html Apache License 2.0
+ * @copyright Copyright (c) 2008, Tim Akinbo
+ */
+
+define('PREFIX', "about:chr:");
+define('LENGTH', 2000 - strlen(PREFIX)); # Internet Explorer 2KB URI limit (http://support.microsoft.com/kb/208427)
+
+function encode($string)
+{
+ $quoted = urlencode($string);
+ $out = "";
+ for ($i = 0; $i < strlen($quoted); $i+=LENGTH)
+ {
+ $out .= "@import url(" . PREFIX . substr($quoted, $i, $i+LENGTH) . ");\n";
+ }
+ return $out;
+}
+
+?>

0 comments on commit 03feccc

Please sign in to comment.