Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • Text_Highlighter
  • Text_Highlighter_ABAP
  • Text_Highlighter_CPP
  • Text_Highlighter_CSS
  • Text_Highlighter_DIFF
  • Text_Highlighter_DTD
  • Text_Highlighter_Generator
  • Text_Highlighter_HTML
  • Text_Highlighter_JAVA
  • Text_Highlighter_JAVASCRIPT
  • Text_Highlighter_MYSQL
  • Text_Highlighter_PERL
  • Text_Highlighter_PHP
  • Text_Highlighter_PYTHON
  • Text_Highlighter_Renderer
  • Text_Highlighter_Renderer_Array
  • Text_Highlighter_Renderer_BB
  • Text_Highlighter_Renderer_Console
  • Text_Highlighter_Renderer_Html
  • Text_Highlighter_Renderer_HtmlTags
  • Text_Highlighter_Renderer_JSON
  • Text_Highlighter_Renderer_XML
  • Text_Highlighter_RUBY
  • Text_Highlighter_SH
  • Text_Highlighter_SQL
  • Text_Highlighter_VBSCRIPT
  • Text_Highlighter_XML
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 3: /**
 4:  * JSON renderer.
 5:  *
 6:  * Based on the HTML renderer by Andrey Demenev.
 7:  *
 8:  * LICENSE: This source file is subject to version 3.0 of the PHP license
 9:  * that is available through the world-wide-web at the following URI:
10:  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
11:  * the PHP License and are unable to obtain it through the web, please
12:  * send a note to license@php.net so we can mail you a copy immediately.
13:  *
14:  * @category   Text
15:  * @package    Text_Highlighter
16:  * @author     Stoyan Stefanov <ssttoo@gmail.com>
17:  * @copyright  2006 Stoyan Stefanov
18:  * @license    http://www.php.net/license/3_0.txt  PHP License
19:  * @version    CVS: $Id: JSON.php,v 1.1 2007/06/03 02:37:09 ssttoo Exp $
20:  * @link       http://pear.php.net/package/Text_Highlighter
21:  */
22: 
23: /**
24:  * @ignore
25:  */
26: 
27: require_once dirname(__FILE__).'/../Renderer.php';
28: require_once dirname(__FILE__).'/../Renderer/Array.php';
29: 
30: /**
31:  * JSON renderer, based on Andrey Demenev's HTML renderer.
32:  *
33:  * @author     Stoyan Stefanov <ssttoo@gmail.com>
34:  * @category   Text
35:  * @package    Text_Highlighter
36:  * @copyright  2006 Stoyan Stefanov
37:  * @license    http://www.php.net/license/3_0.txt  PHP License
38:  * @version    Release: 0.5.0
39:  * @link       http://pear.php.net/package/Text_Highlighter
40:  */
41: 
42: class Text_Highlighter_Renderer_JSON extends Text_Highlighter_Renderer_Array
43: {
44: 
45:     /**
46:      * Signals that no more tokens are available
47:      *
48:      * @abstract
49:      * @access public
50:      */
51:     function finalize()
52:     {
53: 
54:         parent::finalize();
55:         $output = parent::getOutput();
56: 
57:         $json_array = array();
58: 
59:         foreach ($output AS $token) {
60: 
61:             if ($this->_enumerated) {
62:                 $json_array[] = '["' . $token[0] . '","' . $token[1] . '"]';
63:             } else {
64:                 $key = key($token);
65:                 $json_array[] = '{"class": "' . $key . '","content":"' . $token[$key] . '"}';
66:             }
67: 
68:         }
69: 
70:         $this->_output  = '['. implode(',', $json_array) .']';
71:         $this->_output = str_replace("\n", '\n', $this->_output);
72: 
73:     }
74: 
75: 
76: }
77: 
78: /*
79:  * Local variables:
80:  * tab-width: 4
81:  * c-basic-offset: 4
82:  * c-hanging-comment-ender-p: nil
83:  * End:
84:  */
85: 
86: ?>
API documentation generated by ApiGen 2.8.0