[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkActionView/helpers/ -> mail_helper.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   3  
   4  // +----------------------------------------------------------------------+
   5  // | Akelos Framework - http://www.akelos.org                             |
   6  // +----------------------------------------------------------------------+
   7  // | Copyright (c) 2002-2006, Akelos Media, S.L.  & Bermi Ferrer Martinez |
   8  // | Released under the GNU Lesser General Public License, see LICENSE.txt|
   9  // +----------------------------------------------------------------------+
  10  
  11  /**
  12   * @package AkelosFramework
  13   * @subpackage Helpers
  14   * @author Bermi Ferrer <bermi a.t akelos c.om>
  15   * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
  16   * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
  17   */
  18  
  19  require_once (AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'text_helper.php');
  20  
  21  class MailHelper
  22  {
  23      function setController(&$controller)
  24      {
  25          $this->_controller =& $controller;
  26      }
  27  
  28     /**
  29     * Uses TextHelper::format to take the text and format it, indented two spaces for
  30     * each line, and wrapped at 72 columns.
  31     */
  32      function block_format($text)
  33      {
  34          $formatted = '';
  35          $paragraphs = split("(\n|\r){2,}",$text);
  36          foreach ((array)$paragraphs as $paragraph){
  37              $formatted .= TextHelper::format($paragraph, array('columns' => 72, 'first_indent' => 2, 'body_indent' => 2));
  38          }
  39          // Make list points stand on their own line
  40          return preg_replace("/[ ]*([*]+) ([^*]*)/"," $1 $2\n", preg_replace("/[ ]*([#]+) ([^#]*)/"," $1 $2\n",$formatted));
  41      }
  42      
  43  }
  44  
  45  ?>


Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6