Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

owsimpleoperator: write a template operator in a few lines

This page is for developers who need a small template operator, or want templates to call a PHP function. A full operator class is often more work than the operator deserves. owsimpleoperator (from Open Wide) lets you…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/features/6.0/extensions/owsimpleoperator.md

On this page

owsimpleoperator: write a template operator in a few lines

This page is for developers who need a small template operator, or want templates to call a PHP function. A full operator class is often more work than the operator deserves. owsimpleoperator (from Open Wide) lets you write each operator as a small class with plain methods: less boilerplate and more readable code. It also lets templates call PHP functions and class methods as operators, but only those you list explicitly.

What you get

  • Call any permitted PHP function as a template operator.
  • Utility methods for your PHP code: string manipulation, object attribute manipulation, object type control and output manipulation.

Constraints:

  • An optional operator argument must default to null.
  • For more than 10 arguments, override $max_operator_parameter.

Allow a PHP function or class method

Nothing is callable unless you list it in owsimpleoperator.ini. This is what ships:

[PHPFunctions]
PermittedFunctionList[]
PermittedFunctionList[]=time
PermittedFunctionList[]=mktime
PermittedFunctionList[]=getdate
PermittedFunctionList[]=str_replace
PermittedFunctionList[]=str_rot13
PermittedFunctionList[]=file_get_contents
[ClassOperators]
PermittedClassOperatorList[]
[OWSimpleOperatorSettings]
DebugOutput=enabled
FileBlockKeyDefaultMeaning
owsimpleoperator.iniPHPFunctionsPermittedFunctionList[]the list abovePHP functions templates may call
owsimpleoperator.iniClassOperatorsPermittedClassOperatorList[]emptyClass methods templates may call
owsimpleoperator.iniOWSimpleOperatorSettingsDebugOutputenabledDebug output

Security: file_get_contents lets a template read any file the web server can read. Remove it from the list on production sites that do not need it (the other entries are harmless). A function that is not permitted cannot be called from a template.

What changed in the Exponential 6 releases

VersionDateChange
1.2.07 January 2024composer.json, ezinfo.php and extension.xml versions.
1.2.1The extension name is lowercase to prevent errors.
1.2.2 to 1.2.527 to 30 September 2026The extension states its version, license and website; the license is named in the metadata; the description names Exponential.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x