com php-src: Bringing CSS up to this decade's standards.: ext/standard/css.c ext/standard/css.h ext/standard/info.c

From: Date: Thu, 08 Nov 2012 18:08:45 +0000
Subject: com php-src: Bringing CSS up to this decade's standards.: ext/standard/css.c ext/standard/css.h ext/standard/info.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-72733@lists.php.net to get a copy of this message
Commit: ff93287fff44ad31d8e0bc9d5ea945719b0d40b0 Author: Colin Viebrock <colin@viebrock.ca> Thu, 8 Nov 2012 12:08:45 -0600 Parents: e383d4d20ddeb908569c5ad8cd4772c738f2db99 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ff93287fff44ad31d8e0bc9d5ea945719b0d40b0 Log: Bringing CSS up to this decade's standards. Here are some tweaks to the phpinfo() styling, since this really hasn't been touched in almost a decade: - color codes are shortened - table width is bigger and handled via CSS - fix so that long INI entries don't make the layout super wide - bgcolor for "Additional Modules" wasn't set - fix my email address Signed-off-by: Colin Viebrock <colin@viebrock.ca> Changed paths: M ext/standard/css.c M ext/standard/css.h M ext/standard/info.c

diff --git a/ext/standard/css.c b/ext/standard/css.c index 17588c2..4be25b7 100644 --- a/ext/standard/css.c +++ b/ext/standard/css.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Colin Viebrock <colin@easydns.com> | + | Authors: Colin Viebrock <colin@viebrock.ca> | +----------------------------------------------------------------------+ */ @@ -23,25 +23,24 @@ PHPAPI void php_info_print_css(TSRMLS_D) /* {{{ */ { - PUTS("body {background-color: #ffffff; color: #000000;}\n"); - PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n"); - PUTS("pre {margin: 0px; font-family: monospace;}\n"); - PUTS("a:link {color: #000099; text-decoration: none; background-color: #ffffff;}\n"); + PUTS("body {background-color: #fff; color: #000; font-family: sans-serif;}\n"); + PUTS("pre {margin: 0; font-family: monospace;}\n"); + PUTS("a:link {color: #009; text-decoration: none; background-color: #fff;}\n"); PUTS("a:hover {text-decoration: underline;}\n"); - PUTS("table {border-collapse: collapse;}\n"); + PUTS("table {border-collapse: collapse; border: 0; width: 75%; min-width: 600px;}\n"); PUTS(".center {text-align: center;}\n"); - PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}\n"); - PUTS(".center th { text-align: center !important; }\n"); - PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n"); + PUTS(".center table {margin: 0 auto; text-align: left;}\n"); + PUTS(".center th {text-align: center !important;}\n"); + PUTS("td, th {border: 1px solid #000; font-size: 75%; vertical-align: baseline; padding: 3px 5px;}\n"); PUTS("h1 {font-size: 150%;}\n"); PUTS("h2 {font-size: 125%;}\n"); PUTS(".p {text-align: left;}\n"); - PUTS(".e {background-color: #ccccff; font-weight: bold; color: #000000;}\n"); - PUTS(".h {background-color: #9999cc; font-weight: bold; color: #000000;}\n"); - PUTS(".v {background-color: #cccccc; color: #000000;}\n"); - PUTS(".vr {background-color: #cccccc; text-align: right; color: #000000;}\n"); - PUTS("img {float: right; border: 0px;}\n"); - PUTS("hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}\n"); + PUTS(".e {background-color: #ccf; font-weight: bold;}\n"); + PUTS(".h {background-color: #99c; font-weight: bold;}\n"); + PUTS(".v {background-color: #ccc; max-width: 20em; overflow-y: scroll;}\n"); + PUTS(".v i {color: #999;}\n"); + PUTS("img {float: right; border: 0;}\n"); + PUTS("hr {width: 800px; background-color: #ccc; border: 0; height: 1px;}\n"); } /* }}} */ diff --git a/ext/standard/css.h b/ext/standard/css.h index ab49658..8bf13b8 100644 --- a/ext/standard/css.h +++ b/ext/standard/css.h @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Colin Viebrock <colin@easydns.com> | + | Authors: Colin Viebrock <colin@viebrock.ca> | +----------------------------------------------------------------------+ */ diff --git a/ext/standard/info.c b/ext/standard/info.c index beb1477..cbc8606 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf <rasmus@php.net> | | Zeev Suraski <zeev@zend.com> | - | Colin Viebrock <colin@easydns.com> | + | Colin Viebrock <colin@viebrock.ca> | +----------------------------------------------------------------------+ */ @@ -67,7 +67,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */ int written; char *new_str; TSRMLS_FETCH(); - + new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC); written = php_output_write(new_str, new_len TSRMLS_CC); efree(new_str); @@ -81,11 +81,11 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */ int len, written; va_list argv; TSRMLS_FETCH(); - + va_start(argv, fmt); len = vspprintf(&buf, 0, fmt, argv); va_end(argv); - + written = php_output_write(buf, len TSRMLS_CC); efree(buf); return written; @@ -103,7 +103,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC { char *key; uint len; - + if (ht) { if (zend_hash_num_elements(ht)) { HashPosition pos; @@ -113,7 +113,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC } else { php_info_printf("\nRegistered %s => ", name); } - + zend_hash_internal_pointer_reset_ex(ht, &pos); while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { @@ -125,7 +125,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC break; } } - + if (!sapi_module.phpinfo_as_text) { php_info_print("</td></tr>\n"); } @@ -160,10 +160,10 @@ PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* { } } else { if (!sapi_module.phpinfo_as_text) { - php_info_printf("<tr><td>%s</td></tr>\n", zend_module->name); + php_info_printf("<tr><td class=\"v\">%s</td></tr>\n", zend_module->name); } else { php_info_printf("%s\n", zend_module->name); - } + } } } /* }}} */ @@ -208,7 +208,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) php_info_print(name); php_info_print("[\""); - + switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: if (!sapi_module.phpinfo_as_text) { @@ -432,7 +432,7 @@ char* php_get_windows_name() sub = "Web Edition"; else sub = "Standard Edition"; } - } + } } if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) { @@ -525,7 +525,7 @@ PHPAPI char *php_get_uname(char mode) DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; - + GetComputerName(ComputerName, &dwSize); if (mode == 's') { @@ -574,7 +574,7 @@ PHPAPI char *php_get_uname(char mode) if (mode == 's') { php_uname = buf.sysname; } else if (mode == 'r') { - snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d", + snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d", buf.netware_major, buf.netware_minor, buf.netware_revision); php_uname = tmp_uname; } else if (mode == 'n') { @@ -664,7 +664,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) char temp_api[10]; php_uname = php_get_uname('a'); - + if (!sapi_module.phpinfo_as_text) { php_info_print_box_start(1); } @@ -688,7 +688,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); - } + } php_info_print_box_end(); php_info_print_table_start(); php_info_print_table_row(2, "System", php_uname ); @@ -773,7 +773,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) #else php_info_print_table_row(2, "DTrace Support", "disabled" ); #endif - + php_info_print_stream_hash("PHP Streams", php_stream_get_url_stream_wrappers_hash() TSRMLS_CC); php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC); php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC); @@ -805,7 +805,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print("<h1>Configuration</h1>\n"); } else { SECTION("Configuration"); - } + } if (!(flag & PHP_INFO_MODULES)) { SECTION("PHP Core"); display_ini_entries(NULL); @@ -879,7 +879,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } - if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { + if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { php_info_print_hr(); php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE TSRMLS_CC); } @@ -920,17 +920,17 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (!sapi_module.phpinfo_as_text) { php_info_print("</div></body></html>"); - } + } } /* }}} */ PHPAPI void php_info_print_table_start(void) /* {{{ */ { if (!sapi_module.phpinfo_as_text) { - php_info_print("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n"); + php_info_print("<table>\n"); } else { php_info_print("\n"); - } + } } /* }}} */ @@ -955,7 +955,7 @@ PHPAPI void php_info_print_box_start(int flag) /* {{{ */ php_info_print("<tr class=\"v\"><td>\n"); } else { php_info_print("\n"); - } + } } } /* }}} */ @@ -988,7 +988,7 @@ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* { } else { spaces = (74 - strlen(header)); php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); - } + } } /* }}} */ @@ -1003,7 +1003,7 @@ PHPAPI void php_info_print_table_header(int num_cols, ...) va_start(row_elements, num_cols); if (!sapi_module.phpinfo_as_text) { php_info_print("<tr class=\"h\">"); - } + } for (i=0; i<num_cols; i++) { row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { @@ -1032,7 +1032,7 @@ PHPAPI void php_info_print_table_header(int num_cols, ...) /* {{{ php_info_print_table_row_internal */ -static void php_info_print_table_row_internal(int num_cols, +static void php_info_print_table_row_internal(int num_cols, const char *value_class, va_list row_elements) { int i; @@ -1040,13 +1040,13 @@ static void php_info_print_table_row_internal(int num_cols, if (!sapi_module.phpinfo_as_text) { php_info_print("<tr>"); - } + } for (i=0; i<num_cols; i++) { if (!sapi_module.phpinfo_as_text) { php_info_printf("<td class=\"%s\">", (i==0 ? "e" : value_class ) ); - } + } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { if (!sapi_module.phpinfo_as_text) { @@ -1061,7 +1061,7 @@ static void php_info_print_table_row_internal(int num_cols, php_info_print(row_element); if (i < num_cols-1) { php_info_print(" => "); - } + } } } if (!sapi_module.phpinfo_as_text) { @@ -1081,7 +1081,7 @@ static void php_info_print_table_row_internal(int num_cols, PHPAPI void php_info_print_table_row(int num_cols, ...) { va_list row_elements; - + va_start(row_elements, num_cols); php_info_print_table_row_internal(num_cols, "v", row_elements); va_end(row_elements); @@ -1090,11 +1090,11 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) /* {{{ php_info_print_table_row_ex */ -PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, ...) { va_list row_elements; - + va_start(row_elements, value_class); php_info_print_table_row_internal(num_cols, value_class, row_elements); va_end(row_elements); @@ -1222,7 +1222,7 @@ PHP_FUNCTION(php_ini_scanned_files) if (zend_parse_parameters_none() == FAILURE) { return; } - + if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) { RETURN_STRING(php_ini_scanned_files, 1); } else { @@ -1238,7 +1238,7 @@ PHP_FUNCTION(php_ini_loaded_file) if (zend_parse_parameters_none() == FAILURE) { return; } - + if (php_ini_opened_path) { RETURN_STRING(php_ini_opened_path, 1); } else {
« previous php.cvs (#72733) next »