Changeset 669301
- Timestamp:
- 02/17/2013 04:11:32 PM (13 years ago)
- Location:
- facebook-comments-notifier
- Files:
-
- 4 edited
-
tags/1.2/facebook-comments-notifier.php (modified) (4 diffs)
-
tags/1.2/fb-comments.js (modified) (2 diffs)
-
trunk/facebook-comments-notifier.php (modified) (4 diffs)
-
trunk/fb-comments.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
facebook-comments-notifier/tags/1.2/facebook-comments-notifier.php
r669072 r669301 33 33 34 34 // fcn_htmlencode: options for whitespace conversion 35 define( 'FCN_HTML_NBSP', 1 ); // " " -> " " 36 define( 'FCN_HTML_BR', 2 ); // "\r" -> "<br />" 37 define( 'FCN_HTML_NBSP_BR', 3); // 1 + 2 38 define( 'FCN_HTML_BR_NBSP', 3); // 1 + 2 39 define( 'FCN_HTML_ATTRIB', 4); // "\n" -> "\r" -> 35 // default: \n -> &x10; \r -> &x13; 36 define( 'FCN_HTML_BR', 1 ); // "\n" -> "<br />" 37 define( 'FCN_HTML_NBSP', 2 ); // " " -> " " 38 define( 'FCN_HTML_NBSP_BR', 3); // 1 + 2 39 define( 'FCN_HTML_BR_NBSP', 3); // 1 + 2 40 define( 'FCN_HTML_PRESERVE', 4); // no change 40 41 41 42 … … 401 402 402 403 // handle whitespace conversion 403 if ( $ws == 1 || $ws == 3 ) 404 { 405 $html = str_replace( "\t", ' ', $html ); 406 $html = str_replace( ' ', ' ', $html ); 407 } 408 409 if ( $ws == 2 || $ws == 3 ) 410 { 411 $html = str_replace( "\r\n", "\n", $html ); // pc 412 $html = str_replace( "\r", "\n", $html ); // mac (old <= 9) 413 $html = str_replace( "\n", '<br />', $html ); 414 } 415 416 if ( $ws == 4 ) 404 if ( $ws ) 405 { 406 if ( $ws == 2 || $ws == 3 ) 407 { 408 $html = str_replace( "\t", ' ', $html ); 409 $html = str_replace( ' ', ' ', $html ); 410 } 411 412 if ( $ws == 1 || $ws == 3 ) 413 { 414 $html = str_replace( "\r\n", "\n", $html ); // pc 415 $html = str_replace( "\r", "\n", $html ); // mac (old <= 9) 416 $html = str_replace( "\n", '<br />', $html ); 417 } 418 } 419 else 417 420 { 418 421 $html = str_replace( "\n", ' ', $html ); … … 430 433 foreach ( $def as $key => $value ) 431 434 { 432 $attrs .= ' '.$key.'="'.fcn_htmlencode($value ,FCN_HTML_ATTRIB).'"';435 $attrs .= ' '.$key.'="'.fcn_htmlencode($value).'"'; 433 436 } 434 437 return $attrs; … … 564 567 } 565 568 566 $html .= '<option value="'. fcn_htmlencode($key , FCN_HTML_ATTRIB) . '" ';569 $html .= '<option value="'. fcn_htmlencode($key) . '" '; 567 570 568 571 // allow single or multiple selected values -
facebook-comments-notifier/tags/1.2/fb-comments.js
r669291 r669301 1 1 // encode data for html context 2 var FCN_HTML_NBSP = 1; // ' ' -> 3 var FCN_HTML_BR = 2; // \n \r -> <br /> 4 var FCN_HTML_NBSP_BR = 3; // 1 + 2 5 var FCN_HTML_BR_NBSP = 3; // 1 + 2 6 var FCN_HTML_ATTRIB = 4; // \n -> &x10; \r -> &x13; 2 // default: \n -> &x10; \r -> &x13; 3 var FCN_HTML_BR = 1; // \n -> <br /> 4 var FCN_HTML_NBSP = 2; // ' ' -> 5 var FCN_HTML_NBSP_BR = 3; // 1 + 2 6 var FCN_HTML_BR_NBSP = 3; // 1 + 2 7 var FCN_HTML_PRESERVE = 4; // preserve 7 8 8 9 function fcn_htmlencode (str, ws) { … … 18 19 // encode whitespace 19 20 if ( ws ) { 20 if ( ws == 1 || ws == 3 ) { 21 // translate space 22 if ( ws == 2 || ws == 3 ) { 21 23 str = str.replace(/ /g, " "); 22 24 str = str.replace(/\t/g, " "); 23 25 } 24 // also insert line breaks 25 if ( ws == 2 || ws == 3 ) { 26 // htmlify line breaks 27 if ( ws == 1 || ws == 3 ) { 28 str = str.replace(/\r\n/g, "\n"); //pc 29 str = str.replace(/\r/g, "\r"); // mac <= 9 26 30 str = str.replace(/\n/g, "<br />"); 27 31 } 28 // also insert line breaks 29 if ( ws == 4 ) { 30 str = str.replace(/\n/g, " "); 31 str = str.replace(/\r/g, " "); 32 } 32 } else { 33 // for attributes/general 34 str = str.replace(/\n/g, " "); 35 str = str.replace(/\r/g, " "); 33 36 } 34 37 return str.valueOf(); -
facebook-comments-notifier/trunk/facebook-comments-notifier.php
r669072 r669301 33 33 34 34 // fcn_htmlencode: options for whitespace conversion 35 define( 'FCN_HTML_NBSP', 1 ); // " " -> " " 36 define( 'FCN_HTML_BR', 2 ); // "\r" -> "<br />" 37 define( 'FCN_HTML_NBSP_BR', 3); // 1 + 2 38 define( 'FCN_HTML_BR_NBSP', 3); // 1 + 2 39 define( 'FCN_HTML_ATTRIB', 4); // "\n" -> "\r" -> 35 // default: \n -> &x10; \r -> &x13; 36 define( 'FCN_HTML_BR', 1 ); // "\n" -> "<br />" 37 define( 'FCN_HTML_NBSP', 2 ); // " " -> " " 38 define( 'FCN_HTML_NBSP_BR', 3); // 1 + 2 39 define( 'FCN_HTML_BR_NBSP', 3); // 1 + 2 40 define( 'FCN_HTML_PRESERVE', 4); // no change 40 41 41 42 … … 401 402 402 403 // handle whitespace conversion 403 if ( $ws == 1 || $ws == 3 ) 404 { 405 $html = str_replace( "\t", ' ', $html ); 406 $html = str_replace( ' ', ' ', $html ); 407 } 408 409 if ( $ws == 2 || $ws == 3 ) 410 { 411 $html = str_replace( "\r\n", "\n", $html ); // pc 412 $html = str_replace( "\r", "\n", $html ); // mac (old <= 9) 413 $html = str_replace( "\n", '<br />', $html ); 414 } 415 416 if ( $ws == 4 ) 404 if ( $ws ) 405 { 406 if ( $ws == 2 || $ws == 3 ) 407 { 408 $html = str_replace( "\t", ' ', $html ); 409 $html = str_replace( ' ', ' ', $html ); 410 } 411 412 if ( $ws == 1 || $ws == 3 ) 413 { 414 $html = str_replace( "\r\n", "\n", $html ); // pc 415 $html = str_replace( "\r", "\n", $html ); // mac (old <= 9) 416 $html = str_replace( "\n", '<br />', $html ); 417 } 418 } 419 else 417 420 { 418 421 $html = str_replace( "\n", ' ', $html ); … … 430 433 foreach ( $def as $key => $value ) 431 434 { 432 $attrs .= ' '.$key.'="'.fcn_htmlencode($value ,FCN_HTML_ATTRIB).'"';435 $attrs .= ' '.$key.'="'.fcn_htmlencode($value).'"'; 433 436 } 434 437 return $attrs; … … 564 567 } 565 568 566 $html .= '<option value="'. fcn_htmlencode($key , FCN_HTML_ATTRIB) . '" ';569 $html .= '<option value="'. fcn_htmlencode($key) . '" '; 567 570 568 571 // allow single or multiple selected values -
facebook-comments-notifier/trunk/fb-comments.js
r669291 r669301 1 1 // encode data for html context 2 var FCN_HTML_NBSP = 1; // ' ' -> 3 var FCN_HTML_BR = 2; // \n \r -> <br /> 4 var FCN_HTML_NBSP_BR = 3; // 1 + 2 5 var FCN_HTML_BR_NBSP = 3; // 1 + 2 6 var FCN_HTML_ATTRIB = 4; // \n -> &x10; \r -> &x13; 2 // default: \n -> &x10; \r -> &x13; 3 var FCN_HTML_BR = 1; // \n -> <br /> 4 var FCN_HTML_NBSP = 2; // ' ' -> 5 var FCN_HTML_NBSP_BR = 3; // 1 + 2 6 var FCN_HTML_BR_NBSP = 3; // 1 + 2 7 var FCN_HTML_PRESERVE = 4; // preserve 7 8 8 9 function fcn_htmlencode (str, ws) { … … 18 19 // encode whitespace 19 20 if ( ws ) { 20 if ( ws == 1 || ws == 3 ) { 21 // translate space 22 if ( ws == 2 || ws == 3 ) { 21 23 str = str.replace(/ /g, " "); 22 24 str = str.replace(/\t/g, " "); 23 25 } 24 // also insert line breaks 25 if ( ws == 2 || ws == 3 ) { 26 // htmlify line breaks 27 if ( ws == 1 || ws == 3 ) { 28 str = str.replace(/\r\n/g, "\n"); //pc 29 str = str.replace(/\r/g, "\r"); // mac <= 9 26 30 str = str.replace(/\n/g, "<br />"); 27 31 } 28 // also insert line breaks 29 if ( ws == 4 ) { 30 str = str.replace(/\n/g, " "); 31 str = str.replace(/\r/g, " "); 32 } 32 } else { 33 // for attributes/general 34 str = str.replace(/\n/g, " "); 35 str = str.replace(/\r/g, " "); 33 36 } 34 37 return str.valueOf();
Note: See TracChangeset
for help on using the changeset viewer.