From 3494bd7d4aaa96295aafc2f25168e4f576101465 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 16 Oct 2008 22:46:17 -0400 Subject: [PATCH] more cleanup --- README | 22 +++++++++++++++++----- htdocs/index.html | 5 +++-- htdocs/php_goes_here-crushed.png | Bin 0 -> 4864 bytes htdocs/style.css | 3 ++- src/JavaScriptTarget.hx | 9 +++++++++ src/TestCommandLineInterface.hx | 17 +++++++++++++++++ 6 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 htdocs/php_goes_here-crushed.png create mode 100644 src/TestCommandLineInterface.hx diff --git a/README b/README index 7ea0bef..a7090eb 100644 --- a/README +++ b/README @@ -1,16 +1,28 @@ -Harmonious Code's internals are currently a complete mess. You have been warned. +(Harmonious Code's internals are currently a complete mess. You have been warned.) + +Harmonious Code is a static code analyzer for PHP, primarily geared toward +ensuring that the code you're writing will work on a particular base level +PHP installation. It will double-check each function and constant (and soon, +language constructs) that you're using and provide you with the minimum +version of PHP requires, as well as any necessary PECL modules, to run the +code that you've written. To build & use Harmonious Code on Unix-like operating systems: * Make sure you're running haXe 2. * Download the PHP documentation from CVS. -* Copy/symlink the phpdoc/phpbook/phpbook-xsl/version.xml file from the - PHP documentation into the data directory as version.xml. -* Run build/test.sh. This will take a while as functions_tokens_cache.hxd is +* Run the build/phpdoc_setup.sh script, passing either the relative or absolute + path to your phpdoc CVS folder: + + cd build + ./phpdoc_setup.sh /var/www/harmoniouscode/phpdoc + +* Run build/test.sh. This will take a short while as all_tokens.hxd is built in the data directory. It will also ensure everything's working correctly. * Run build/javascript.sh. The harmoniouscode.js file will be generated - in htdocs. + in htdocs. You'll also have a zip file with the entire Harmonious + Code bundle to pass off to others. * Open htdocs/index.html and try analyzing some PHP code. * Run build/command_line.sh and pass the path to a PHP file as the first parameter. A basic analysis should appear. diff --git a/htdocs/index.html b/htdocs/index.html index c599782..37a06b9 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -1,6 +1,6 @@ - Harmonious Code: Will my PHP code and Web hosting work together? + Harmonious Code: The PHP Static Code Version Checker
Loading... @@ -22,7 +23,7 @@

- +
diff --git a/htdocs/php_goes_here-crushed.png b/htdocs/php_goes_here-crushed.png new file mode 100644 index 0000000000000000000000000000000000000000..3d3737331763e31ece655d610a2c4b2708e61630 GIT binary patch literal 4864 zcma)=WlS7QyN1!l3dOA~ZiU6Az~U^jxD_e76e;eDJAH9kXt8C{0&Q^?C=_?M7Kav> zV&%o1k8|>!|K~|&=DH`7Oftz#GFP0gwkk0pJs}1L1~F6(qK|=r33_5-e85w`J-f~G zG~jqELJjesDj453_9+v1sF`{{t)Kg!hN;Mn^naS9^HDbOF>tr{@q>BUVfgv^@jJRX zd%uNw*zvo2IUtXu=`k?KL!b}^L;uA?3&+&geN@!A(@nh`LOiiARARe&tu=9k-hY0_ z`th>~RdI$1hf`4rrxPI+jV3!M3uK+18Bq{P__>LBogNZhGt}An4Ba&aHRIXLxy zweo5vb5HWD?QeVbC8ITp$*OIwE$B8+He`IROeepcVKv}4CgFRZT1-jfHYABxq zfkvS&H|*sTl4mIX7db%hpRik>o09N5|<=Ks5!bS9|?3HN39 zpg69#Gd3`Mbt?ojjk+6tGWzll6^}5`sK@u>dO69>j$p#c&U0{3h;>BCc38QX(A36>Wj(m)uc`6re z0_QNcioLx(Ar|(n?lwo(G2^EoZL>dH$%t=Apn)K4x#_<--*3CPfLGVm{on>2VIs#T0Og=E`-4Ouuu!bQlqG=l{6mIG1 zS(}MOwqT?6MP$Kh<&~9V8z8#|ky@e?2JExMG#`g(DixE`$|(JUVr&rvQbRGXCw#+T z{`XusoBpKs^Ht;*H9U{ydDT^G$7;t}R~>7kkdP2&7~MiLv%tDa&lfl+~to?B&#G z^Rfce7Zsf`l`0i$TtVP&KE%wStI-ky-nv>EH!u>uG5zND3n!fom1b`-;Xy_%t6H32 z&KFc*?k@7}MeQ%8h=1SN#M$j1?5Lmvd;_AzLv7&vG=yiDr=#z}^6Va$!aJf7q#+n5 zt#Lu|pf-0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X67HUhHn*(B-j{s7bKnqJ_g~roX14Sm}zGM}xafzlWCD#H2nVLPGnJ z=G?UvcA~wmMjEyWho;hR&2Eye-Ey;=QTM80R$i^&9k32c<0u#hCghTp+HOP6d~u87 zmAFn1E&LeY^xymDO1w;{cc4iWct*SwfmbI9y;4QLqxcXZtS4^8IULhzLv(Nud4G;N zO4KY>iUV86KKAV3S}btj=)ES`Ibia!)ME_hbi_(|(=@}cEQo$#)h9ImeVdG&?zj>M zdI_EV8)8l{`fUH!JU!L|!-6JC;?=5mqg7tG&>#)j&rO`aKZ=h0AEi>YDUSFsBs-GB zqTT5UNwW<9=&V>>D$G}Cr#i6b?uwd~wtdgu; z*;hk1vUEAjRia+E;-{om)-UllC61=)f=;S8?5B=X1DiwbpY4c9PP}!Re2raH;Ch9u zu7D{&?iLh#fo4Uk)dEGa+=wOWkK)${a!?C)S+veczst#zXjWH(y?YPsgVXXpbr8Dy zJY%nD<2K-i9pXvJkm!BUe6Xx`Z#CR~%=sxZuugR61;J__qpWCmCRxk-PP0khSCTZy zM@iSbz1Z?5$TZ9$hwv}%gT@jm)xWMJLI~$CN&3CzPig~q<6Xta5mt7hG6(&t($dnY zDw-=v!C-;?zgJHmk3D>_gr;VSp@SYb%y&a(rKF@pnQWrqo+UkirM*+3 zFlm9C{sSf~?8V2++hPS&E{vWTD`AFq$uaf+!lU8g<(1R%?eoWKW@IMtFhjM-@MrVz z@T||w%)Gt4&`)haJrI$WBz^#THEwThCFyZJ?N-wNr)ea8geIj{ycfV4Rp~reg+h!U z?qOtWi?--5m1tsYna8ZS&8wab6e}R3A9w`GK;i;tU?U);@V`Rl|MboO+vNQFvGWm= Y&SaXu)p1DW$yQ-Nm9-&Niq?_;0cThw$N&HU literal 0 HcmV?d00001 diff --git a/htdocs/style.css b/htdocs/style.css index 3e77233..e70672d 100644 --- a/htdocs/style.css +++ b/htdocs/style.css @@ -7,7 +7,7 @@ body, td, div, li, p, span { font-size: 12px; } -h1 { +h1, h2 { text-align: center } @@ -71,6 +71,7 @@ th.is-filtering { textarea#source { width: 750px; height: 250px; + background: white url(php_goes_here-crushed.png) center center no-repeat; } div#footer { diff --git a/src/JavaScriptTarget.hx b/src/JavaScriptTarget.hx index ef7456f..248ddd9 100644 --- a/src/JavaScriptTarget.hx +++ b/src/JavaScriptTarget.hx @@ -27,6 +27,15 @@ class JavaScriptTarget { loading_div.style.display = "none"; form_div.style.display = ""; + + var source = js.Lib.document.getElementById("source"); + untyped { + if (source.value != "") { + source.style.backgroundImage = "none"; + } else { + source.onclick = function(e) { source.style.backgroundImage = "none"; } + } + } #end } diff --git a/src/TestCommandLineInterface.hx b/src/TestCommandLineInterface.hx new file mode 100644 index 0000000..e22d9d0 --- /dev/null +++ b/src/TestCommandLineInterface.hx @@ -0,0 +1,17 @@ +import CommandLineInterface; + +class TestCommandLineInterface extends haxe.unit.TestCase { + function testOptionParsing() { + var options = [ + [ [ "meow.php" ], "{file => meow.php}" ], + [ [ "--file", "meow.php" ], "{file => meow.php}" ], + [ [ "--php-version", "5.2.0", "meow.php" ], "{php-version => 5.2.0, file => meow.php}" ] + ]; + + for (option in options) { + var arguments : Array = option[0]; + var expected_result : String = option[1]; + assertEquals(expected_result.length, CommandLineInterface.parse_arguments(arguments).toString().length); + } + } +} \ No newline at end of file