[ 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 param: string $code Javascript code to bookmarkletify return: string Bookmarklet link |
encodeURIComponent( $str ) X-Ref |
PHP port of Javascript function encodeURIComponent From http://stackoverflow.com/a/1734255/36850 param: string $str String to encode since: return: string Encoded string |
kill_comments( $code ) X-Ref |
Kill comment lines and blocks param: string $code Commented Javascript code return: string Commentless code |
compress_white_space( $code ) X-Ref |
Compress white space Remove some extraneous spaces and make the whole script a one liner param: string $code Javascript code return: string Compressed 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 param: string $code Javascript code return: string 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 param: string $code Javascript code return: string Javascript code with placeholders (eg "__1__") instead of literal strings |
restore_strings( $code ) X-Ref |
Restore literal strings by replacing their placeholders with actual strings param: string $code Javascript code with placeholders return: string Javascript code with actual strings |
Generated: Sat Apr 26 05:10:07 2025 | Cross-referenced by PHPXref 0.7.1 |