Other conventions (time zones, IP, gallery)
A collection of core conventions worth knowing when building third-party extensions.
Time zone handling
Zittme manages time zones in two parts.
| Type | Meaning | Setting |
|---|---|---|
| Internal time zone | A fixed time zone used when storing dates in the DB. Set at installation and cannot be changed afterward | locale.internal_timezone |
| Display time zone | The time zone used when showing dates on screen. Admins can change it | locale.default_timezone |
Dates are mostly stored as YYYYMMDDHHIISS strings.
Rules for development:
- Store in the internal time zone:
date('YmdHis'),getInternalDateTime() - Display in the display time zone:
zdate($value, 'Y-m-d'),getDisplayDateTime() - If you cut a stored value with
substrand show it as is, it will be off on sites in other time zones. Always usezdate()for display. - The core calculates daylight saving time automatically. Do not handle it yourself.
Thanks to this structure, stored dates stay correct even when you move servers.
IP addresses and range notation
Places that accept IPs, such as block lists and allow lists, support the following notations.
| Notation | Example |
|---|---|
| Single IPv4 | 192.168.122.96 |
| Wildcard | 192.168.122.*, 192.168.*.* |
| Range | 192.168.122.0-192.168.122.255 |
| CIDR | 192.168.216.0/24 |
| IPv6 | 2001:2300::ffff:0, ::1 |
| IPv6 CIDR | 2001:2300::/64 |
Use the core filter for validation and matching in code. IPv6 has many notations, so parsing it yourself is risky.
use Zittme\Framework\Filters\IpFilter;
IpFilter::validateRange($range); // 대역 표기가 올바른가
IpFilter::inRange($ipaddress, $range); // 이 IP가 대역에 드는가PhotoSwipe (image gallery)
A feature that shows content images enlarged in a gallery when clicked is built in as an add-on. It works in skins without any extra integration, as long as you follow the markup rules.
- Images inside a container with the
xe_content(orrhymix_content) class automatically become gallery items. By convention, skins add this class to the content output area. - To include an image outside the container in the gallery, add the
photoswipe-imagesclass (takes priority over exclusion rules). - To exclude a specific image from the gallery, add the
photoswipe-escape(orrx-escape) class. - Images inside links (
a), code (pre,code), and form elements are excluded automatically.
<div class="rhymix_content xe_content">{!! $oDocument->getContent(false) !!}</div>
<img class="photoswipe-images" src="poster.jpg" alt="" /> <!-- 본문 밖이지만 갤러리 포함 -->
<img class="photoswipe-escape" src="icon.png" alt="" /> <!-- 갤러리 제외 -->