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

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • 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

Class Convert

Library of conversion functions, implemented as static methods.

The methods are all of the form (format)2(format), where the format is one of
raw: A UTF8 string attr: A UTF8 string suitable for inclusion in an HTML attribute js: A UTF8 string suitable for inclusion in a double-quoted javascript string.
array: A PHP associative array json: JavaScript object notation
html: HTML source suitable for use in a page or email text: Plain-text content, suitable for display to a user as-is, or insertion in a plaintext email.

Objects of type ViewableData can have an "escaping type", which determines if they are automatically escaped before output by SSViewer.

Package: sapphire\misc
Located at sapphire/core/Convert.php

Methods summary

public static array|string
# raw2att( array|string $val )

Convert a value to be suitable for an XML attribute.

Convert a value to be suitable for an XML attribute.

Parameters

$val
array|string $val String to escape, or array of strings

Returns

array|string
array|string

Used by

Convert::raw2htmlatt()
public static array|string
# raw2htmlatt( array|string $val )

Convert a value to be suitable for an HTML attribute.

Convert a value to be suitable for an HTML attribute.

This is useful for converting human readable values into a value suitable for an ID or NAME attribute.

Parameters

$val
array|string $val String to escape, or array of strings

Returns

array|string
array|string

See

http://www.w3.org/TR/REC-html40/types.html#type-cdata

Uses

Convert::raw2att()
public static array|string
# raw2xml( array|string $val )

Ensure that text is properly escaped for XML.

Ensure that text is properly escaped for XML.

Parameters

$val
array|string $val String to escape, or array of strings

Returns

array|string
array|string

See

http://www.w3.org/TR/REC-xml/#dt-escape
public static array|string
# raw2js( array|string $val )

Ensure that text is properly escaped for Javascript.

Ensure that text is properly escaped for Javascript.

Parameters

$val
array|string $val String to escape, or array of strings

Returns

array|string
array|string
public static string
# raw2json( mixed $val )

Uses the PHP 5.2 native json_encode function if available, otherwise falls back to the Services_JSON class.

Uses the PHP 5.2 native json_encode function if available, otherwise falls back to the Services_JSON class.

Parameters

$val
mixed $val

Returns

string
JSON safe string

See

http://pear.php.net/pepr/pepr-proposal-show.php?id=198

Uses

Director::baseFolder()
Services_JSON
public static
# raw2sql( mixed $val )
public static
# xml2raw( mixed $val )

Convert XML to raw text.

Convert XML to raw text.

Uses

Convert::html2raw()
public static string
# array2json( array $val )

Convert an array into a JSON encoded string.

Convert an array into a JSON encoded string.

Parameters

$val
array $val Array to convert

Returns

string
JSON encoded string

See

http://pear.php.net/pepr/pepr-proposal-show.php?id=198

Uses

Director::baseFolder()
Services_JSON
public static mixed
# json2obj( string $val )

Convert a JSON encoded string into an object.

Convert a JSON encoded string into an object.

Parameters

$val
string $val

Returns

mixed
JSON safe string

See

http://pear.php.net/pepr/pepr-proposal-show.php?id=198

Uses

Director::baseFolder()
Services_JSON

Used by

Convert::json2array()
public static array|boolean
# json2array( string $val )

Convert a JSON string into an array.

Convert a JSON string into an array.

Parameters

$val
string $val JSON string to convert

Returns

array|boolean
array|boolean

Uses

Convert::json2obj()
public static
# xml2array( mixed $val )

Uses

Convert::recursiveXMLToArray()
protected static
# recursiveXMLToArray( mixed $xml )

Function recursively run from Convert::xml2array()

Function recursively run from Convert::xml2array()

Uses

SimpleXMLElement

Used by

Convert::xml2array()
public static A
# linkIfMatch( string $string )

Create a link if the string is a valid URL

Create a link if the string is a valid URL

Parameters

$string
string The string to linkify

Returns

A
link to the URL if string is a URL
public static
# html2raw( mixed $data, mixed $preserveLinks = false, mixed $wordWrap = 0, mixed $config = null )

Simple conversion of HTML to plaintext.

Simple conversion of HTML to plaintext.

Parameters

$data
$data string
$preserveLinks
$preserveLinks boolean
$wordWrap
$wordwrap array
$config

Used by

Convert::xml2raw()
public static string
# raw2mailto( mixed $data )

There are no real specifications on correctly encoding mailto-links, but this seems to be compatible with most of the user-agents. Does nearly the same as rawurlencode(). Please only encode the values, not the whole url, e.g. "mailto:test@test.com?subject=" . Convert::raw2mailto($subject)

There are no real specifications on correctly encoding mailto-links, but this seems to be compatible with most of the user-agents. Does nearly the same as rawurlencode(). Please only encode the values, not the whole url, e.g. "mailto:test@test.com?subject=" . Convert::raw2mailto($subject)

Parameters

$data
$data string

Returns

string
string

See

http://www.ietf.org/rfc/rfc1738.txt
public static
# rus2lat( mixed $string )
public static string
# number2name( mixed $num, mixed $name1, mixed $name2_4, mixed $nameOther )

Generate correct name of object for integer number of object

Generate correct name of object for integer number of object

Parameters

$num
$num int number of object
$name1
$name1 string name for *[1] object
$name2_4
$name2_4 string name for *[2-4] objects
$nameOther
$nameOther string name for 11-19, *[0,5-9] objects

Returns

string
string

Magic methods summary

[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.2 API Docs API documentation generated by ApiGen 2.8.0