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

  • CGoogleApi
  • CHtml
  • CJavaScript
  • CJavaScriptExpression
  • CJSON
  • X2Html
  • Overview
  • Package
  • Class
  • Tree

Class CJSON

CJSON converts PHP data to and from JSON format.

Package: system\web\helpers
Copyright: 2005 Michal Migurski
License: http://www.opensource.org/licenses/bsd-license.php
Author: Michal Migurski <mike-json@teczno.com>
Author: Matt Knapp <mdknapp[at]gmail[dot]com>
Author: Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
Since: 1.0
Located at x2engine/framework/web/helpers/CJSON.php
Methods summary
public static string
# encode( mixed $var )

Encodes an arbitrary variable into JSON format

Encodes an arbitrary variable into JSON format

Parameters

$var
mixed
$var any number, boolean, string, array, or object to be encoded. If var is a string, it will be converted to UTF-8 format first before being encoded.

Returns

string
JSON string representation of input var
protected static string
# nameValue( string $name, mixed $value )

array-walking function for use in generating JSON-formatted name-value pairs

array-walking function for use in generating JSON-formatted name-value pairs

Parameters

$name
string
$name name of key to use
$value
mixed
$value reference to an array element to be encoded

Returns

string
JSON-formatted name-value pair, like 'name
protected static string
# reduceString( string $str )

reduce a string by removing leading and trailing comments and whitespace

reduce a string by removing leading and trailing comments and whitespace

Parameters

$str
string
$str string value to strip of comments and whitespace

Returns

string
string value stripped of comments and whitespace
public static mixed
# decode( string $str, boolean $useArray = true )

decodes a JSON string into appropriate variable

decodes a JSON string into appropriate variable

Parameters

$str
string
$str JSON-formatted string
$useArray
boolean
$useArray whether to use associative array to represent object data

Returns

mixed
number, boolean, string, array, or object corresponding to given JSON input string. Note that decode() always returns strings in ASCII or UTF-8 format!
protected static string
# utf8ToUnicode( string & $str )

This function returns any UTF-8 encoded text as a list of Unicode values:

This function returns any UTF-8 encoded text as a list of Unicode values:

Parameters

$str
string
$str string to convert

Returns

string

Author

Scott Michael Reynen <scott@randomchaos.com>

See

CJSON::unicodeToUTF8()

Link

http://www.randomchaos.com/document.php?source=php_and_unicode
protected static string
# unicodeToUTF8( string & $str )

This function converts a Unicode array back to its UTF-8 representation

This function converts a Unicode array back to its UTF-8 representation

Parameters

$str
string
$str string to convert

Returns

string

Author

Scott Michael Reynen <scott@randomchaos.com>

See

CJSON::utf8ToUnicode()

Link

http://www.randomchaos.com/document.php?source=php_and_unicode
protected static string
# utf8ToUTF16BE( string & $str, boolean $bom = false )

UTF-8 to UTF-16BE conversion.

UTF-8 to UTF-16BE conversion.

Maybe really UCS-2 without mb_string due to utf8ToUnicode limits

Parameters

$str
string
$str string to convert
$bom
boolean
$bom whether to output BOM header

Returns

string
protected static string
# utf16beToUTF8( string & $str )

UTF-8 to UTF-16BE conversion.

UTF-8 to UTF-16BE conversion.

Maybe really UCS-2 without mb_string due to utf8ToUnicode limits

Parameters

$str
string
$str string to convert

Returns

string
Constants summary
integer JSON_SLICE 1
#

Marker constant for JSON::decode(), used to flag stack state

Marker constant for JSON::decode(), used to flag stack state

integer JSON_IN_STR 2
#

Marker constant for JSON::decode(), used to flag stack state

Marker constant for JSON::decode(), used to flag stack state

integer JSON_IN_ARR 4
#

Marker constant for JSON::decode(), used to flag stack state

Marker constant for JSON::decode(), used to flag stack state

integer JSON_IN_OBJ 8
#

Marker constant for JSON::decode(), used to flag stack state

Marker constant for JSON::decode(), used to flag stack state

integer JSON_IN_CMT 16
#

Marker constant for JSON::decode(), used to flag stack state

Marker constant for JSON::decode(), used to flag stack state

API documentation generated by ApiGen 2.8.0