PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/src/site/components/com_notifications/templates/filters/link.php

https://github.com/bhar1red/anahita
PHP | 53 lines | 19 code | 4 blank | 30 comment | 1 complexity | db620eefdd7f3103dd3194a2ebfeedc2 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * LICENSE: ##LICENSE##
  4. *
  5. * @category Anahita
  6. * @package Com_Notifications
  7. * @subpackage Template
  8. * @author Arash Sanieyan <ash@anahitapolis.com>
  9. * @author Rastin Mehr <rastin@anahitapolis.com>
  10. * @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc
  11. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
  12. * @version SVN: $Id$
  13. * @link http://www.anahitapolis.com
  14. */
  15. /**
  16. * Fixes the styles of the links
  17. *
  18. * @category Anahita
  19. * @package Com_Notifications
  20. * @subpackage Template
  21. * @author Arash Sanieyan <ash@anahitapolis.com>
  22. * @author Rastin Mehr <rastin@anahitapolis.com>
  23. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
  24. * @link http://www.anahitapolis.com
  25. */
  26. class ComNotificationsTemplateFilterLink extends KTemplateFilterAbstract implements KTemplateFilterWrite
  27. {
  28. /**
  29. * Fixes blockquotes
  30. *
  31. * @param string Block of text to parse
  32. * @return KTemplateFilterLink
  33. */
  34. public function write(&$text)
  35. {
  36. $matches = array();
  37. if ( preg_match_all('/<a(.*?)>/', $text, $matches) )
  38. {
  39. foreach($matches[1] as $index => $match)
  40. {
  41. $attribs = $this->_parseAttributes($match);
  42. $attribs['style'] = 'color:#076da0;text-decoration:none';
  43. $attribs = KHelperArray::toString($attribs);
  44. $text = str_replace($matches[0][$index], '<a '.$attribs.' >', $text);
  45. }
  46. }
  47. return $this;
  48. }
  49. }