Changeset 4501
- Timestamp:
- 01/23/12 15:53:56 (4 months ago)
- Location:
- plugins/apostrophePlugin/branches/1.5
- Files:
-
- 2 modified
-
lib/toolkit/aHtml.class.php (modified) (1 diff)
-
web/js/a.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/branches/1.5/lib/toolkit/aHtml.class.php
r4376 r4501 673 673 // This is worth it to produce cacheable content though 674 674 $class = 'a-email-' . sprintf("%u", crc32($user . '@' . $domain . ':' . $label)); 675 $href = rawurlencode("mailto:$user@$domain"); 676 $label = rawurlencode(trim($label)); 677 // This is an acceptable way to stub in a js call for now, since it's the 678 // way the helper has to do it too 679 aTools::$jsCalls[] = array('callable' => 'apostrophe.unobfuscateEmail(?, ?, ?)', 'args' => array($class, $href, $label)); 680 return "<a href='#' class='$class'></a>"; 675 $href = "mailto:$user@$domain"; 676 if (sfConfig::get('app_a_inline_obfuscate_mailto')) 677 { 678 $result = '<a href="#" class="a-obs-email ' . $class . '" data-prefix="' . $user . '" data-suffix="' . $domain . '" data-label="' . $label . '"></a>'; 679 } 680 else 681 { 682 // This is an acceptable way to stub in a js call for now, since it's the 683 // way the helper has to do it too 684 $result = "<a href='#' class='$class'></a>"; 685 $label = rawurlencode(trim($label)); 686 $href = rawurlencode($href); 687 aTools::$jsCalls[] = array('callable' => 'apostrophe.unobfuscateEmail(?, ?, ?)', 'args' => array($class, $href, $label)); 688 } 689 return $result; 681 690 } 682 691 -
plugins/apostrophePlugin/branches/1.5/web/js/a.js
r4490 r4501 340 340 this.unobfuscateEmail = function(aClass, email, label) 341 341 { 342 aLog('apostrophe.unobfuscateEmail -- ' + aClass + ', ' + email + ', ' + label); 342 343 $('.' + aClass).attr('href', unescape(email)).html(unescape(label)); 343 344 }; 345 346 347 /** 348 apostrophe.unobfuscateEmailInline -- works in conjunction with an app.yml flag: 349 // a: 350 // inline_obfuscate_mailto: true 351 To unobfuscate all emails loaded on a page after a_js has fired. 352 */ 353 this.unobfuscateEmailInline = function() { 354 var links = $('.a-obs-email'); 355 if (links.length) 356 { 357 links.each(function(){ 358 $self = $(this); 359 $self.attr('href', 'mailto:' + $self.attr('data-prefix') + '@' + $self.attr('data-suffix')).html($self.attr('data-label')); 360 }); 361 }; 362 }; 344 363 345 364 // Turns a form into an AJAX form that updates the element

