buepro / typo3-auxlibs
提供第三方库,用于非Composer模式。以下库已嵌入:hashids/hashids, erusev/parsedown。
v1.4.0
2021-10-26 17:42 UTC
Requires
- erusev/parsedown: ~1.7.4
- hashids/hashids: ~4.1.0
- rlanvin/php-rrule: ~2.3.0
- typo3/cms-core: ^10.4 || ^11.5.1
Requires (Dev)
- clue/phar-composer: ^1.2.0
- friendsofphp/php-cs-fixer: ^3.0.0
- friendsoftypo3/phpstan-typo3: ^0.8.1
- overtrue/phplint: ^2.3.5
- phpstan/phpstan: ^0.12.87
- phpstan/phpstan-deprecation-rules: ^0.12.6
- phpstan/phpstan-phpunit: ^0.12.19
- phpstan/phpstan-strict-rules: ^0.12.9
Replaces
- buepro/typo3-auxlibs: v1.4.0
- typo3-ter/auxlibs: v1.4.0
README
本TYPO3扩展提供第三方库,用于非Composer模式。
目前以下库可用
库
Hashids
Hashids 是一个小型的PHP库,用于从数字生成类似于YouTube的ID。当您不希望向用户暴露数据库ID时使用它。
示例
$hashids = new \Hashids\Hashids; $handle = $hashids->encode(5, 5, 5);
Parsedown
Parsedown 将使用 Markdown语法 的文本转换为HTML。
示例
$parsedown = new \Parsedown; $htmlText = $parsedown->text($markdownText);
视图助手
有一个视图助手可用,可以使用以下方式使用:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:auxlibs="http://typo3.org/ns/Buepro/Auxlibs/ViewHelpers" data-namespace-typo3-fluid="true"> <!--Inline mode--> {auxlibs:parsedown(text: textWithMarkedownSyntax)} {task.description -> auxlibs:parsedown()} <!--Tag mode--> <auxlibs:parsedown text="{task.description}" /> <auxlibs:parsedown>{task.description}</auxlibs:parsedown> </html>
视图助手有以下属性
PHP RRule
RRule 是PHP中轻量级且快速的重复规则实现(来自RFC 5545中的RRULE),用于轻松计算重复/重复的日期和事件(如日历中的事件)。
示例
$rrule = new RRule('RRULE:FREQ=DAILY;UNTIL=19971224T000000Z;WKST=SU;BYDAY=MO,WE,FR;BYMONTH=1'); foreach ($rrule as $occurrence) { echo $occurrence->format('r'),"\n"; }
使用 RSet 可以定义更复杂的规则
$rset = new RSet( "DTSTART;TZID=America/New_York:19970901T090000 RRULE:FREQ=DAILY;COUNT=3 EXRULE:FREQ=DAILY;INTERVAL=2;COUNT=1 EXDATE;TZID=America/New_York:19970903T090000 RDATE;TZID=America/New_York:19970904T090000" );
用法
库在中间件中自动加载。如果需要更早地使库可用,可以使用包含语句进行加载。库 hashids
的包含语句如下所示
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; @include 'phar://' . ExtensionManagementUtility::extPath('auxlibs') . 'Libraries/hashids-hashids.phar/vendor/autoload.php';