flextype-components/html
Composer 安装命令:
composer require flextype-components/html
包简介
Html Component contains methods that can be useful when working with HTML.
关键字:
README 文档
README
Html Component contains methods that can be useful when working with HTML.
Installation
composer require flextype-components/html
Usage
use Flextype\Component\Html\Html;
Registers a custom macro.
// Registering a Html macro Html::macro('my_element', function() { return '<element id="flextype">'; }); // Calling a custom Html macro echo Html::my_element(); // Registering a Html macro with parameters Html::macro('my_element', function($id = '') { return '<element id="'.$id.'">'; }); // Calling a custom Html macro with parameters echo Html::my_element('flextype');
Convert special characters to HTML entities. All untrusted content
should be passed through this method to prevent XSS injections.
echo Html::toText('test');
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.'</div>';
Create br tags
echo Html::br(2);
Create
echo Html::nbsp(2);
Create an arrow
echo Html::arrow('right');
Create HTML link anchor.
echo Html::anchor('About', 'http://sitename.com/about');
Create HTML tag
echo Html::heading('Title', 1);
Generate document type declarations
echo Html::doctype('html5');
Create image
echo Html::image('data/files/pic1.jpg');
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
echo Html::email('hello@flextype.org');
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');
License
See LICENSE
统计信息
- 总下载量: 3.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-30