Rewrites align parameter to a class style


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.