Posted By

nijgnet on 02/25/08


Tagged

css alignment


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

basicmagic


Rewrites align parameter to a class style


 / Published in: PHP
 

  1. /*
  2.  * Replaces align parameter with a class style.
  3.  * Example: align="left" -> class="alignleft"
  4.  *
  5.  * @param $html String: html code of <img>
  6.  * @return $html String: modified html code
  7.  */
  8. function rewrite_imgalign ($html)
  9. {
  10. return preg_replace('/align=\"(\w+)\"/i', 'class="align${1}"', $html);
  11. }

Report this snippet  

You need to login to post a comment.