Html


Class: \Flextype\Component\Html\Html

Visibility Function
public static __callStatic(\string $method, array $parameters) : mixed
Dynamically handle calls to custom macros.
public static anchor(\string $title, \string $url='', array $attributes=null) : string
Create HTML link anchor. echo Html::anchor('About', 'http://sitename.com/about');
public static arrow(\string $direction) : string
Create an arrow echo Html::arrow('right');
public static attributes(array $attributes=null) : string
Compiles an array of HTML attributes into an attribute string. Attributes will be sorted using Html::$attribute_order for consistency. echo '<div'.Html::attributes($attrs).'>'.$content.'';
public static br(\integer $num=1) : string
Create br tags echo Html::br(2);
public static doctype(\string $type='html5') : mixed
Generate document type declarations echo Html::doctype('html5');
public static email(\string $email) : string
Obfuscate an e-mail address to prevent spam-bots from sniffing it. echo Html::email('hello@flextype.org');
public static heading(\string $title, \integer $h=1, array $attributes=null) : string
Create HTML tag echo Html::heading('Title', 1);
public static image(\string $file, array $attributes=null) : string
Create image echo Html::image('data/files/pic1.jpg');
public static macro(\string $name, \Flextype\Component\Html\Closure $macro) : void
Registers a custom macro. // Registering a Html macro Html::macro('my_element', function() { return ''; }); // Calling a custom Html macro echo Html::my_element(); // Registering a Html macro with parameters Html::macro('my_element', function($id = '') { return ''; }); // Calling a custom Html macro with parameters echo Html::my_element('flextype');
public static nbsp(\integer $num=1) : string
Create   echo Html::nbsp(2);
public static obfuscate(\string $value) : string
Obfuscate a string to prevent spam-bots from sniffing it. This method obfuscate the value, randomly convert each letter to its entity or hexadecimal representation, keeping a bot from sniffing the randomly obfuscated letters. echo Html::obfuscate('hello@flextype.org');
public static toText(\string $value, \boolean $double_encode=true) : string
Convert special characters to HTML entities. All untrusted content should be passed through this method to prevent XSS injections. echo Html::toText('test');
Language: en, ru