[ Index ] |
PHP Cross Reference of YOURLS |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 197 lines (6 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Bookmarkletgen:: (7 methods):
crunch()
encodeURIComponent()
kill_comments()
compress_white_space()
combine_strings()
replace_strings()
restore_strings()
Class: Bookmarkletgen - X-Ref
BookmarkletGen : converts readable Javascript code into a bookmarklet linkcrunch( $code ) X-Ref |
Main function, calls all others return: string Bookmarklet link param: string $code Javascript code to bookmarkletify |
encodeURIComponent( $str ) X-Ref |
PHP port of Javascript function encodeURIComponent From http://stackoverflow.com/a/1734255/36850 since: return: string Encoded string param: string $str String to encode |
kill_comments( $code ) X-Ref |
Kill comment lines and blocks return: string Commentless code param: string $code Commented Javascript code |
compress_white_space( $code ) X-Ref |
Compress white space Remove some extraneous spaces and make the whole script a one liner return: string Compressed code param: string $code Javascript code |
combine_strings( $code ) X-Ref |
Combine any consecutive strings In the case we have two consecutive quoted strings (eg: "hello" + "world"), save a couple more length and combine them return: string Javascript code param: string $code Javascript code |
replace_strings( $code ) X-Ref |
Replace all literal strings (eg: "hello world") with a placeholder and collect them in an array The idea is that strings cannot be trimmed or white-space optimized: take them out first before uglifying the code, then we'll reinject them back in later return: string Javascript code with placeholders (eg "__1__") instead of literal strings param: string $code Javascript code |
restore_strings( $code ) X-Ref |
Restore literal strings by replacing their placeholders with actual strings return: string Javascript code with actual strings param: string $code Javascript code with placeholders |
Generated: Tue Jan 21 05:10:11 2025 | Cross-referenced by PHPXref 0.7.1 |