Development

Changeset 17767

You must first sign up to be able to contribute.

Changeset 17767

Show
Ignore:
Timestamp:
04/29/09 17:23:15 (4 years ago)
Author:
COil
Message:

[sfBBCodeParserPlugin]
* demo module
* implemented other filters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfBBCodeParserPlugin/trunk/README

    r17745 r17767  
    5252>Check the changelog TAB to see changelogs of >= 1.0.0 versions  
    5353 
     54Bugs: 
     55==== 
     56 
     57* ImageFilter does not allow to have spaces in alt or title attributes 
     58 
    5459---- 
    5560 
  • plugins/sfBBCodeParserPlugin/trunk/config/bb_code_parser_config.yml

    r17753 r17767  
    55  close:      "]" 
    66  xmlclose:   true 
    7   #filters:    "Basic,Extended,Images,Links,Lists,Email" 
    8   filters:    "Basic,Extended" 
     7  filters:    "Basic,Extended,Images,Links,Lists,Email" 
  • plugins/sfBBCodeParserPlugin/trunk/config/bb_code_parser_tags.yml

    r17753 r17767  
    9494      allowed:    "all" 
    9595      attributes: { } 
     96 
     97  Images: 
     98    img: 
     99      htmlopen: "img" 
     100      htmlclose: "" 
     101      allowed:    "none" 
     102      attributes: { src: "src=%2$s%1$s%2$s", w: "width=%2$s%1$d%2$s", h: "height=%2$s%1$d%2$s", alt: "alt=%2$s%1$s%2$s", title: "title=%2$s%1$s%2$s" } 
     103 
     104  Links: 
     105    url: 
     106      htmlopen:  "a" 
     107      htmlclose: "a" 
     108      allowed:   "none^img" 
     109      attributes: { href: "href=%2$s%1$s%2$s" } 
     110 
     111  Lists: 
     112    list: 
     113      htmlopen:   "ol" 
     114      htmlclose:  "ol" 
     115      allowed:    "all" 
     116      child:      "none^li" 
     117      attributes: { list: "style=%2$slist-style-type:%1$s;%2$s" } 
     118 
     119    ulist: 
     120      htmlopen:   "ul" 
     121      htmlclose:  "ul" 
     122      allowed:    "all" 
     123      child:      "none^li" 
     124      attributes: { list: "style=%2$slist-style-type:%1$s;%2$s" } 
     125 
     126    li: 
     127      htmlopen:   "li" 
     128      htmlclose:  "li" 
     129      allowed:    "all" 
     130      parent:     "none^ulist,list" 
     131      attributes: { } 
     132 
     133  Email:       
     134    email: 
     135      htmlopen:   "a" 
     136      htmlclose:  "a" 
     137      allowed:    "none^img" 
     138      attributes: { email: href="%2$smailto:%1$s%2$s" } 
  • plugins/sfBBCodeParserPlugin/trunk/lib/BBCodeParser/Filter/EmailFilter.class.php

    r17753 r17767  
    55 * @author   Stijn de Reede  <sjr@gmx.co.uk> 
    66 * @author   COil 
    7  * @since    1.0.0 - 19 mar 08 
     7 * @since    1.0.0 - 29 avr 09 
    88 */ 
    99 
     
    1616   *  
    1717   * @author COil 
    18    * @since  19 mar 08 
     18   * @since  29 avr 09 
    1919   */ 
    2020  public function __construct($options = array()) 
     
    4848  function _preparse() 
    4949  { 
    50     $options = sfBBCodeParserConfig::getConfig(); 
     50    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    5151 
    5252    $o = $options['open']; 
  • plugins/sfBBCodeParserPlugin/trunk/lib/BBCodeParser/Filter/ImagesFilter.php

    r17744 r17767  
    55 * @author   Stijn de Reede  <sjr@gmx.co.uk> 
    66 * @author   COil 
    7  * @since    1.0.0 - 20 mar 08 
     7 * @since    1.0.0 - 29 avr 09 
    88 */ 
    99 
     
    1111{ 
    1212 
    13   /** 
    14    * Code name of filter. 
    15    *  
    16    * @author COil 
    17    * @since  1.0.0 - 20 mar 08 
    18    */ 
    19   public static $_filterName = 'Images'; 
    20    
    2113  /** 
    2214   * New constructor to retrieve the tags for the filter from  
     
    3224 
    3325    // Now retrieves the attributes from the config file 
    34     $this->_definedTags = sfBBCodeParserConfig::getDefinedTagsForFilter(self::$_filterName); 
     26    $this->_definedTags = sfBBCodeParserPluginConfigHandler::getDefinedTagsForFilter('Images'); 
    3527  }   
    3628 
     
    5648  function _preparse() 
    5749  { 
    58     $options = sfBBCodeParserConfig::getConfig(); 
     50    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    5951 
    6052    $o  = $options['open']; 
  • plugins/sfBBCodeParserPlugin/trunk/lib/BBCodeParser/Filter/LinksFilter.php

    r17744 r17767  
    55 * @author   Stijn de Reede  <sjr@gmx.co.uk> 
    66 * @author   COil 
    7  * @since    1.0.0 - 20 mar 08 
     7 * @since    1.0.0 - 29 avr 09 
    88 */ 
    99 
     
    1111{ 
    1212 
    13   /** 
    14    * Code name of filter. 
    15    *  
    16    * @author COil 
    17    * @since  1.0.0 - 19 mar 08   
    18    */ 
    19   public static $_filterName = 'Links'; 
    20    
    2113  /** 
    2214   * List of allowed schemes 
     
    4840 
    4941    // Now retrieves the attributes from the config file 
    50     $this->_definedTags = sfBBCodeParserConfig::getDefinedTagsForFilter(self::$_filterName); 
     42    $this->_definedTags = sfBBCodeParserPluginConfigHandler::getDefinedTagsForFilter('Links'); 
    5143  }     
    5244 
     
    7062  function _preparse() 
    7163  { 
    72     $options = sfBBCodeParserConfig::getConfig(); 
     64    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    7365    $o = $options['open']; 
    7466    $c = $options['close']; 
     
    9789  function smarterPPLinkExpand($matches) 
    9890  { 
    99     $options = sfBBCodeParserConfig::getConfig(); 
     91    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    10092    $o = $options['open']; 
    10193    $c = $options['close']; 
     
    153145  function smarterPPLink($matches) 
    154146  { 
    155     $options = sfBBCodeParserConfig::getConfig(); 
     147    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    156148    $o = $options['open']; 
    157149    $c = $options['close']; 
  • plugins/sfBBCodeParserPlugin/trunk/lib/BBCodeParser/Filter/ListsFilter.php

    r17744 r17767  
    55 * @author   Stijn de Reede  <sjr@gmx.co.uk> 
    66 * @author   COil 
    7  * @since    1.0.0 - 20 mar 08 
     7 * @since    1.0.0 - 28 avr 09 
    88 */ 
    99 
     
    1212 
    1313  /** 
    14    * Code name of filter. 
    15    *  
    16    * @author COil 
    17    * @since  1.0.0 - 20 mar 08   
    18    */ 
    19   public static $_filterName = 'Lists'; 
    20    
    21   /** 
    2214   * New constructor to retrieve the tags for the filter from  
    2315   * the sf configuation. 
    2416   *  
    2517   * @author COil 
    26    * @since  20 mar 08 
     18   * @since  28 avr 09 
    2719   */ 
    2820  public function __construct($options = array()) 
     
    3224 
    3325    // Now retrieves the attributes from the config file 
    34     $this->_definedTags = sfBBCodeParserConfig::getDefinedTagsForFilter(self::$_filterName); 
     26    $this->_definedTags = sfBBCodeParserPluginConfigHandler::getDefinedTagsForFilter('Lists'); 
    3527  } 
    3628 
     
    5648  function _preparse() 
    5749  { 
    58     $options = sfBBCodeParserConfig::getConfig(); 
     50    $options = sfBBCodeParserPluginConfigHandler::getConfig(); 
    5951     
    6052    $o = $options['open']; 
  • plugins/sfBBCodeParserPlugin/trunk/modules/sfBBCodeParser/templates/indexSuccess.php

    r17753 r17767  
    33<table> 
    44  <tr> 
    5     <td cospan="3"><h2>Basic filter</h2></td> 
     5    <td colspan="3"><h2>Basic filter</h2></td> 
    66  </tr> 
    77  <tr> 
     
    3636  </tr> 
    3737  <tr> 
    38     <hr/> 
    39     <td cospan="3"><h2>Extended filter</h2></td> 
     38    <td colspan="3"><hr/><h2>Extended filter</h2></td> 
    4039  </tr> 
    4140  <tr> 
     
    9897    <td>:</td> 
    9998    <td><?php echo $bb_parser->qparse('[h6]Title 6[/h6]'); ?></td> 
    100   </tr>   
     99  </tr> 
     100  <tr>     
     101    <td colspan="3"><hr/><h2>Images</h2></td> 
     102  </tr> 
     103  <tr> 
     104    <td> 
     105      [img  
     106        src="http://www.symfony-project.org/downloads/logos/symfony.gif"  
     107        alt="Symfony_logo"  
     108        title="Symfony_rocks!"][/img]</td> 
     109    <td>:</td> 
     110    <td><?php echo $bb_parser->qparse('[img src="http://www.symfony-project.org/downloads/logos/symfony.gif" alt="Symfony_logo" title="Symfony_rocks!"][/img]'); ?></td> 
     111  </tr> 
     112  <tr> 
     113    <td colspan="3"><hr/><h2>Links</h2></td> 
     114  </tr> 
     115  <tr> 
     116    <td> 
     117    [url  
     118      href="http://www.symfony-project.org/plugins/sfBBCodeParserPlugin"] 
     119        Back to plugin homepage 
     120    [/url] 
     121    </td> 
     122    <td>:</td> 
     123    <td><?php echo $bb_parser->qparse('[url href="http://www.symfony-project.org/plugins/sfBBCodeParserPlugin"]Back to plugin homepage[/url]'); ?></td> 
     124  </tr> 
     125  <tr> 
     126    <td colspan="3"><hr/><h2>Lists</h2></td> 
     127  </tr> 
     128  <tr> 
     129    <td>[list][*]Element 1 [*]Element 2[/list]</td> 
     130    <td>:</td> 
     131    <td><?php echo $bb_parser->qparse('[list][*]Element 1 [*]Element 2[/list]'); ?></td> 
     132  </tr> 
     133  <tr> 
     134    <td>[ulist][*]Element 1 [*]Element 2[/list]</td> 
     135    <td>:</td> 
     136    <td><?php echo $bb_parser->qparse('[ulist][*]Element 1 [*]Element 2[/ulist]'); ?></td> 
     137  </tr> 
     138  <tr> 
     139    <td>[li]Element 1[/li][li]Element 2[/li]</td> 
     140    <td>:</td> 
     141    <td><?php echo $bb_parser->qparse('[li]Element 3[/li][li]Element 4[/li]'); ?></td> 
     142  </tr> 
     143  <tr> 
     144    <td colspan="3"><hr/><h2>Email</h2></td> 
     145  </tr> 
     146  <tr> 
     147    <td>[email="toto@domain.com"]toto@domain.com[/email]</td> 
     148    <td></td> 
     149    <td><?php echo $bb_parser->qparse('[email="toto@domain.com"]toto@domain.com[/email]'); ?></td> 
     150  </tr> 
    101151</table>