定制 se7enxweb/str_replace 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

se7enxweb/str_replace

Composer 安装命令:

composer require se7enxweb/str_replace

包简介

eZ Publish Legacy extension which provides the ezstr_replace template operator, wrapping PHP's native str_replace() for use directly in eZ Publish templates.

README 文档

README

str_replace is an eZ Publish Legacy extension that exposes PHP's native str_replace() function as the {ezstr_replace} template operator, allowing search-and-replace operations directly inside eZ Publish templates.

  • Author: Alexandre Abric
  • Initial release: April 2005
  • License: GNU General Public License v2

About

The extension registers a single template operator, ezstr_replace, which wraps PHP's built-in str_replace(). It is lightweight, dependency-free, and compatible with any eZ Publish Legacy installation.

Installation

  1. Extract or clone the repository into your extension/ directory so that the path becomes:

    extension/str_replace/
    
  2. Activate the extension. Either use the eZ Publish admin interface (Setup → Extensions), or add it manually to settings/override/site.ini.append.php:

    [ExtensionSettings]
    ActiveExtensions[]=str_replace

    If the [ExtensionSettings] block already exists, just append the second line.

  3. Clear the cache:

    php bin/php/ezcache.php --clear-all

Usage

Use the ezstr_replace operator in any eZ Publish template:

{ezstr_replace($search, $replace, $subject)}
Parameter Type Required Description
$search string yes The value to search for
$replace string yes The replacement value
$subject string yes The string to perform the search on

Examples

Replace a word in a plain string:

{ezstr_replace('world', 'eZ Publish', 'Hello world!')}
{* Output: Hello eZ Publish! *}

Replace content from a node attribute:

{def $cleaned = ezstr_replace('-', ' ', $node.name)}
{$cleaned}

File Structure

extension/str_replace/
├── autoloads/
│   ├── eztemplateautoload.php          # Registers the operator with eZ Publish
│   └── str_replace_controloperator.php # Operator implementation (MyStrReplaceOperator)
├── doc/
│   └── readme.txt                      # Original documentation
├── settings/
│   └── site.ini.append.php             # Extension autoload path setting
├── composer.json
├── ezinfo.php
├── LICENSE
└── README.md

License

This file may be distributed and/or modified under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The GNU General Public License (GPL) is available at http://www.gnu.org/copyleft/gpl.html.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固