Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • ArrayLib
  • BBCodeParser
  • Convert
  • Cookie
  • DataDifferencer
  • Geoip
  • HTMLCleaner
  • HTTP
  • i18n
  • Profiler
  • ShortcodeParser
  • SSHTMLBBCodeParser
  • SSHTMLBBCodeParser_Filter
  • SSHTMLBBCodeParser_Filter_Basic
  • SSHTMLBBCodeParser_Filter_EmailLinks
  • SSHTMLBBCodeParser_Filter_Extended
  • SSHTMLBBCodeParser_Filter_Images
  • SSHTMLBBCodeParser_Filter_Links
  • SSHTMLBBCodeParser_Filter_Lists
  • TextParser
  • Translatable_Transformation
  • XML
 1 <?php
 2 /**
 3  * Parses text in a variety of ways.
 4  * 
 5  * Called from a template by $Content.Parse(SubClassName), similar to $Content.XML.
 6  * This will work on any Text database field (Or a sub-class, such as HTMLText, 
 7  * although it's usefulness in this situation is more limited).
 8  * 
 9  * Any sub-classes of TextParser must implement a parse() method. 
10  * This should take $this->content and parse it however you want. For an example
11  * of the implementation, @see BBCodeParser.
12  * 
13  * Your sub-class will be initialized with a string of text, then parse() will be called.
14  * parse() should (after processing) return the formatted string.
15  * 
16  * Note: $this->content will have NO conversions applied to it. 
17  * You should run Covert::raw2xml or whatever is appropriate before using it. 
18  * 
19  * Optionally (but recommended), is creating a static usable_tags method, 
20  * which will return a DataObjectSet of all the usable tags that can be parsed.
21  * This will (mostly) be used to create helper blocks - telling users what things will be parsed.
22  * Again, @see BBCodeParser for an example of the syntax
23  * 
24  * @todo Define a proper syntax for (or refactor) usable_tags that can be extended as needed.
25  * @package sapphire
26  * @subpackage misc
27  */
28 abstract class TextParser extends Object {
29     protected $content;
30     
31     /**
32      * Creates a new TextParser object.
33      * 
34      * @param string $content The contents of the dbfield
35      */
36     function __construct($content = "") {
37         $this->content = $content;
38     }
39     
40     /**
41      * Convenience method, shouldn't really be used, but it's here if you want it
42      */
43     function setContent($content = "") {
44         $this->content = $content;
45     }
46     
47     /**
48      * Define your own parse method to parse $this->content appropriately.
49      * See the class doc-block for more implementation details.
50      */
51     abstract function parse();
52 }
53 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0