terminal42/contao-inserttags 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

terminal42/contao-inserttags

Composer 安装命令:

composer require terminal42/contao-inserttags

包简介

Contao extension to create custom insert tags.

README 文档

README

Adds a back end module to define your custom insert tags. You can limit an insert tag to certain pages, show it to guests only, or restrict it to certain logged in front end member groups.

For more complex use cases, the extension also supports Contao's Simple Token syntax, which allows for more powerful and dynamic replacements.

Example token

  • Insert tag: phone
  • Replacement: +48 123 456 789
  • Usage: {{custom::phone}}
  • Output: +48 123 456 789

Supported Simple Tokens

The Simple Tokens are split into two types:

Evaluation tokens

The evaluation tokens are meant to be used in the conditional statements and have a format of token.property.

Here is a list of supported evaluation tokens:

  1. member.* – current member properties, if logged in. Caution, it can be null if no member is logged in!
  2. page.* – current page properties.

Examples:

{if member and 456 in member.groups}
This content is visible explicitly to the members of group ID 456.
{endif}

{if page and 123 in page.trail}
I am a subpage of page ID 123!
{endif}

{if page and page_language in ["de_DE", "pl_PL"]}
German and Polish
{else}
All other languages
{endif}

{if page and page_language matches "^de"}
German
{else}
Not German
{endif}

Note: Always check for page and member before doing comparisons. If you are in the Contao back end, none of them are set.

Replacement tokens

The replacement tokens are meant to be used to output the data and have a format of ##token_property##.

Here is a list of supported replacement tokens:

  1. ##member_*## – current member properties, if logged in.
  2. ##page_*## – current page properties.

Examples:

{if member}
Hello ##member_firstname## ##member_lastname##!
{else}
Hello anonymous!
{endif}

You current page language is: ##page_language##

Comments

From version 2.1.0 you can use comments to describe the replacements:

# Show content only to the logged in users
{if member}
Hello ##member_firstname## ##member_lastname##!
{endif}

If you would like to use a hash as the first character of the line, you can escape it as follows: \#.

Security concerns

Q: Why there are two types of token?

A: The evaluation tokens refer to the real objects. However, the objects should NEVER be used as replacement tokens due to security reasons. For that, we introduced the replacement tokens which contain the plain string data.

Q: Why there is no support for the request?

A: The request may contain malicious data that is provided e.g., as a query parameter, and it could be dangerous to allow users to display it in the frontend.

Q: Why there is no support for tag parameters like {{custom::my_tag::my_param_1::my_param_2}}?

A: The tag parameters cannot be validated which is potentially dangerous.

Upgrade from version 1.x

Some options present in version 1.x have been removed. All changes are described below.

Removed "timing"

The timing feature has been removed completely, because it would kill HTTP caching. If you need a replacement, please consider a JavaScript solution.

Removed "limitLanguages"

This option has been removed completely, use the limiting insert tags to certain pages feature instead.

Removed "useCondition"

This option has been removed completely as this too, would make HTTP caching impossible.

Removed "useCounter"

This option has been removed completely as this too, would make HTTP caching impossible.

Removed "mode"

This option has been removed completely, as insert tags are only present in the front end.

Removed "cacheOutput"

This option has been removed completely as it is not required in version 2 anymore.

License

This bundle is released under the MIT license

terminal42/contao-inserttags 适用场景与选型建议

terminal42/contao-inserttags 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51.77k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「backend」 「frontend」 「contao」 「inserttags」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 terminal42/contao-inserttags 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 terminal42/contao-inserttags 我们能提供哪些服务?
定制开发 / 二次开发

基于 terminal42/contao-inserttags 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 51.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-18