DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: punkt.de Tools (pt_tools)

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Rainer Kuhn
Changed:2009-11-27T17:39:16.360000000
Author:Rainer Kuhn
Email:t3extensions@punkt.de
Info 3:
Info 4:

EXT: punkt.de Tools (pt_tools)

Extension Key: pt_tools

Copyright 2005-2009, Rainer Kuhn, <t3extensions@punkt.de>

Manual revised for pt_tools version 1.0.1, 2009-11-27

Extension development sponsored by punkt.de GmbH ( `http://punkt.de/ <http://punkt.de/>`_ )

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: punkt.de Tools (pt_tools) 1

Introduction 1

What does it do? 1

Screenshots 2

Users manual 2

Administration 6

System requirements 6

Installation of pt_tools 6

Configuration 8

Known problems 10

To-Do list 10

Changelog 11

Introduction

What does it do?

pt_tools is a PHP5 toolbox and library for TYPO3 extensions using PHP 5.1+ and TYPO3 4.0+ (or higher). It provides miscellaneous classes, interfaces and static method libraries for TYPO3 extension development with PHP5 and for web development in general.

This library is a dependency for several other pt_* extensions.

Screenshots

img-1

The screenshot shows some of the configuration options of pt_tools in TYPO3's Constant Editor. Administrators/Developers may configure their individual settings here.

Users manual

pt_tools is not intended for end users, but for developers to provide a library for TYPO3 extension development with PHP5. Please refer to the source code and the APIdoc comments within the files for details about the existing classes, methods etc. and their usage.

Here's a brief overview of the main files (some extension have special system requirements, please refer to the chapter “Administration” for details):

res/ abstract

Path

res/ abstract

File

class.tx_pttools_address.php

Type

abstract class

Description

General address class – abstract class to derive your own address classes from

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_beSubmodule.php

Type

abstract class

Description

Abstract parent class for TYPO3 backend submodules

IMPORTANT : This class is experimental and still under development. Implementation is not final, APIs may change anytime!

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_collection.php

Type

abstract class

Description

Abstract class for item collections. Implements the PHP/SPL interfaces IteratorAggregate, Countable and ArrayAccess plus array_{shift|unshift|pop|push|keys} method equivalents

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iPageable.php

Type

interface

Description

Interface for pageable classes: usually a collection of objects that can be splitted up into pages (using a pager)

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iQuickformRenderer.php

Type

interface

Description

Interface for PEAR HTML_Quickform renderers

System requirements

PEAR module 'HTML_Quickform'

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iSettableByArray.php

Type

interface

Description

Interface for objects, whose properties can be set at once by passing an array to a defined method

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iSingleton.php

Type

interface

Description

Interface for Singleton design pattern: besides method implementation definitions this file contains commented-out templates for the default singleton methods to copy

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iSingletonCollection.php

Type

interface

Description

iSingletonCollection interface for singleton collections (returning singleton by an id)

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iStorageAdapter.php

Type

interface

Description

Storage adapter interface

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_iTemplateable.php

Type

interface

Description

Interface for templateable classes

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_objectCollection.php

Type

abstract class

Description

Abstract class for object collections. Implements the PHP/SPL interfaces IteratorAggregate, Countable and ArrayAccess, allows item control by using a restrictedClassName check.

System requirements

res/ abstract

Path

res/ abstract

File

class.tx_pttools_singleton.php

Type

abstract class

Description

DEPRECATED ! This legacy file will be removed in upcoming versions of pt_tools! Use class.tx_pttools_iSingleton.php instead.

System requirements

res/inc

Path

res/inc

File

faketsfe.inc.php

Type

include file

Description

Creates a fake TSFE environment: this may be used to use TypoScript or Frontend functionality if there's no TSFE available by default (e.g. command line scripts, backend, ...). To read TS setup only, you could use tx_pttools_div::returnTyposcriptSetup() instead.

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_cliHandler.php

Type

object to instantiate

Description

A CLI (command line interface) script handler.

IMPORTANT : The tx_pttools_cliHandler::getOptions() method requires the PEAR module 'Console_Getopt' (see http://pear.php.net/manual/en/package.console.console-getopt.php )

to be installed on your server and to be included in the calling CLI script, e.g. by "require_once 'Console/Getopt.php';"

System requirements

PEAR module 'Console_Getopt'

res/ objects

Path

res/ objects

File

class.tx_pttools_collectionElementSelector.php

Type

object to instantiate

Description

Collection Element Selector: This class is intended for frontend use and provides a handling of form-based lists of object collections.

A temporary manual for the Collection Element Selector (CES) can be found in the file doc/manual_collectionElementSelector.txt.

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_exception.php

Type

object to instantiate

Description

General exception class derived from PHP's default Exception class; see res/objects/expections for special case handling

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_feUsersessionStorageAdapter.php

Type

object to instantiate

Description

Session Storage Adapter for TYPO3 frontend _user_ sessions (see tx_pttools_ sessionStorageAdapter for frontend browser sessions).To use the adapter in the eID context as well (where we do not have a TSFE) you have to create a FE user in your eID script (e.g. by: $GLOBALS['TSFE'] = new stdClass(); $GLOBALS['TSFE']->fe_user = tslib_eidtools::initFeUser(); ).

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_formchecker.php

Type

object to instantiate

Description

General webform checker: Class for frontend use, provides methods for checking input content, usually originating from web forms. This includes several special type checks like text, digits, email, zip etc.

Settings for this class can be configured in Constant Editor.

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_formReloadHandler.php

Type

object to instantiate

Description

Web form reload handler (to prevent double execution of web form events on page reload)

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_formTemplateHandler.php

Type

object to instantiate

Description

Web form template handler: This class is intended for frontend use and provides handling of forms, that relate directly to one single data object.

Settings for this class can be configured via TypoScript/Constant Editor, see chapter “Configuration” below.

A (currently German only!) manual for the form template handler (FTH) can be found in the file doc/manual_formTemplateHandler_de.txt.

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_msgBox.php

Type

object to instantiate

Description

Message Box: Provides methods for displaying information and messages in a HTML-Messagebox.

Settings for this class can be configured via TypoScript/Constant Editor, see chapter “Configuration” below.

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_paymentRequestInformation.php

Type

Description

Payment request information class defining a payment request API for online payment transactions, e.g. credit card payments

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_paymentReturnInformation.php

Type

Description

Payment return information class defining a payment return API for online payment transactions, e.g. credit card payments

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_qfDefaultRenderer.php

Type

Description

Adapted default renderer for PEAR HTML_Quickform web forms, extending the PEAR class HTML_QuickForm_Renderer_Default and implementing the interface tx_pttools_iQuickformRenderer. Templates for this renderer can be found in pt_tools at res/tmpl/tx_pttools_quickformRenderer*.html

System requirements

PEAR module 'HTML_Quickform'

res/ objects

Path

res/ objects

File

class.tx_pttools_registry.php

Type

object to instantiate

Description

Class implementing the Registry design pattern (see http://www.patternsforphp.com/wiki/Registry for details)

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_sessionStorageAdapter.php

Type

object to instantiate

Description

Session Storage Adapter for TYPO3 frontend _browser_ sessions and backend user sessions (see tx_pttools_feUsersessionStorageAdapter for frontend user sessions).To use the adapter in the eID context as well (where we do not have a TSFE) you have to create a FE user in your eID script (e.g. by: $GLOBALS['TSFE'] = new stdClass(); $GLOBALS['TSFE']->fe_user = tslib_eidtools::initFeUser(); ).

System requirements

res/ objects

Path

res/ objects

File

class.tx_pttools_smartyAdapter.php

Type

object to instantiate

Description

Adapter class for the Smarty templating engine to set individual directories and extend functionalities (replaces class.tx_smarty.php of the TYPO3 extension 'smarty').

IMPORTANT : This class requires the extension 'smarty' to be installed. Within your extensions based on smarty should create the required cache and compile directories (see pt_tools' ext_localconf.php) with an appropriate entry in their emconf.php file (set 'createDirs' e.g. to 'typo3temp/smarty_cache,typo3temp/smarty_compile')

System requirements

TYPO3 extension 'smarty' + smarty cache and com-pile directories already existent on your server

res/ objects

Path

res/ objects

File

class.tx_pttools_smartyCompiler.php

Type

object to instantiate

Description

Inherits from Smarty_Compiler class, overwrites the default Smarty error triggering method to throw exceptions instead

IMPORTANT : This class requires the extension 'smarty' to be installed.

System requirements

TYPO3 extension 'smarty'

res/ objects

Path

res/ objects

File

class.tx_pttools_usersessStorageAdapter.php

Type

object to instantiate

Description

DEPRECATED ! This legacy file will be removed in upcoming versions of pt_tools! Use class.tx_pttools_feUsersessionStorageAdapter.php instead.

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionAssertion.php

Type

exception object to instantiate

Description

“Assertion failed” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionAuthentication.php

Type

exception object to instantiate

Description

“Authentication error” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionConfiguration.php

Type

exception object to instantiate

Description

“Configuration error” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionDatabase.php

Type

exception object to instantiate

Description

“Database error” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionInternal.php

Type

exception object to instantiate

Description

“Internal error” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionNotImplemented.php

Type

exception object to instantiate

Description

“Not implemented” exception

System requirements

res/ objects/ expections

Path

res/ objects/ expections

File

class.tx_pttools_exceptionWebservice.php

Type

exception object to instantiate

Description

“Webservice error” exception

System requirements

smarty_ plugins

Path

smarty_ plugins

File

function.*.php, modifier.*.phpAvailable addons are(as of Nov. 2009): function.assign_array.php, function.includeCssFile.php, function.includeJsFile.php, modifier.absfn.php, modifier.convertDate.php, modifier.explodeAndPrint.php, modifier.formatsize.php, modifier.ll.php, modifier.numberFormat.php, modifier.registerValue.php, modifier.stdWrap.php, modifier.trace.php, modifier.urlencode.php, modifier.vsprintf.php, modifier.wrap.php

Type

Smarty modifiers, Smarty functions

Description

Additional modifiers and callback functions for usage with the Smarty templating engine (e.g. a modifier to access TYPO3 locallang labels directly from the Smarty template).Please refer to the file names and the files' inline PHPdoc documentation for information about the available addons.

System requirements

TYPO3 extension 'smarty'

res/ staticlib

Path

res/ staticlib

File

class.tx_pttools_assert.php

Type

static method library

Description

Assertion class to test miscellaneous assertions, throws a tx_pttools_exceptionAssertion if an assertion fails

System requirements

res/ staticlib

Path

res/ staticlib

File

class.tx_pttools_debug.php

Type

static method library

Description

General debugging class for extension development, contains several helper functions for debugging and the non-OO function shortcut 'trace()' outside the class context (to use the method tx_pttools_debug::trace() with a shorthand notation like a PHP command)

System requirements

optional: TYPO3 ext. 'geshilib' to use syntax highlighting in traceToHtml()

res/ staticlib

Path

res/ staticlib

File

class.tx_pttools_div.php

Type

static method library

Description

General helper methods library for miscellaneous purposes (similar to t3lib_div).: Main sections are: GENERAL METHODS, DATE/TIME METHODS, LANGUAGE SPECIFIC METHODS, EXTENSION CONFIGURATION RETRIEVAL METHODS, FORMATTING/CONVERSION METHODS, DATABASE RELATED METHODS, DATABASE RELATED METHODS

System requirements

res/ staticlib

Path

res/ staticlib

File

class.tx_pttools_finance.php

Type

static method library

Description

General library class with static finance related methods. IMPORTANT : This class requires PHP to be configured with '--enable-bcmath'!

System requirements

PHP has to be configured with ' --enable-bcmath '

res/ staticlib

Path

res/ staticlib

File

class.tx_pttools_staticInfoTables.php

Type

static method library

Description

Helper methods library (part of the library extension 'pt_tools') to use in combination with the TYPO3 extension 'Static info tables'.

IMPORTANT : This class requires the extension 'static_info_tables' to be installed.

System requirements

TYPO3 extension 'static_info_tables'

res/tmpl

Path

res/tmpl

File

tx_pttools_formTemplateHandler.html

Type

HTML template

Description

Default HTML templates for tx_pttools_formTemplateHandler, see above. The usage of an individual template can be configured via TypoScript/Constant Editor, see chapter “Configuration” below.

System requirements

res/tmpl

Path

res/tmpl

File

tx_pttools_msgBox.html

Type

HTML template

Description

Default HTML templates for tx_pttools_msgBox, see above. The usage of an individual template can be configured via TypoScript/Constant Editor, see chapter “Configuration” below.

System requirements

res/tmpl

Path

res/tmpl

File

tx_pttools_quickformRenderer*.html

Type

HTML template

Description

Example HTML templates for tx_pttools_qfDefaultRenderer (the default renderer for PEAR HTML_Quickform web forms), see above

System requirements

PEAR module 'HTML_Quickform'

[pt_tools: file reference]

Administration

System requirements

These are the mandatory requirements to install and run pt_tools:

  • PHP 5.1 or higher
  • TYPO3 4.0 or higher

Furthermore here are optional installation requirements for the usage of special library classes of pt_tools:

The following suggestions may be helpful for developers for developing and debugging:

  • the TYPO3 extension 'abz_developer' to deactivate TYPO3 caching
  • the TYPO3 extensions 'cc_debug' and 'fb_devlog' for debugging

Installation of pt_tools

TYPO3's extension manager will suggest you to install some of the optional requirements mentioned above. If you don't want to use the special classes these requirements are needed for, or if you've already compiled your PHP installation with ' --enable-bcmath ', you can safely ignore these suggestions and proceed with the installation.

Now you may want to configure the extension'sbasic settings in TYPO3's Extension Manager. The available options are listed here:

Convert errors to exceptions

a

Convert errors to exceptions

b

[convertErrorsToExceptions]

Convert errors to exceptions by using set_error_handler(). Errors

a

Convert errors to exceptions by using set_error_handler(). Errors will be logged as defined in the php.ini (log_errors, error_log) anyhow. Be careful with this options in production environment! You can set which errors to convert by adding "$GLOBALS['tx_pttools_debug']['errors']['FE']" or "$GLOBALS['tx_pttools_debug']['errors']['BE']" to your localconf.php. By default all errors defined in "error_reporting" will be logged in the frontend and all errors defined in "error_reporting" without E_WARNINGS will be logged in the backend. Be sure to catch all exceptions, e.g by switching on the option "catchUncaughtExceptions" below.

Default:

Catch uncaught exceptions

a

Catch uncaught exceptions

b

[catchUncaughtExceptions]

Catch uncaught exceptions (by using set_exception_handler()) and

a

Catch uncaught exceptions (by using set_exception_handler()) and display them with a nice backtrace if IP matches the devIPmask respective display only the message if not. If "convertErrorsToExceptions" is set to true, this option should be set as well, as there might be exceptions (coming from errors) which would not be caught otherwise. In combination with TYPO3's "systemLog" this can be a mighty tool for developing and monitoring.

Default:

After having installed the extension itself, you have to include the static extension template “pt_tools” to your Typoscript template.

img-2

With the static template included, you may want to configure pt_tools for your individual needs. All configurations can be done in TYPO3's Constant Editor. Please refer to the chapter 'Configuration' for details.

Configuration

All configuration options for the extensions have to be set in TYPO3's Constant Editor. Here you can configure some general settings and your individual configuration for selected modules.

Please refer to the following tables for all configuration options:

((generated))

Category: PT_TOOLS [= general configuration]
Admin email for system mails

a

Admin email for system mails

b

[config.pt_tools.adminMail]

Email address for auto-generated admin mails of pt_tools extension

a

Email address for auto-generated admin mails of pt_tools extension (e.g. trace logging errors).

Default:

Currency format

a

Currency format

b

[config.pt_tools.currencyFormat]

Required for tx_pttools_finance::getFormattedPriceString() only -

a

Required for tx_pttools_finance::getFormattedPriceString() only - Currency format to be used in this method, noted in PHP's sprintf syntax (%1$s is the value and %2$s is the currency code)

Default: %1$s %2$s

Trace log output directory

a

Trace log output directory

b

[config.pt_tools.traceLogDir]

Directory path for generated debugging trace logs if $trace is set to

a

Directory path for generated debugging trace logs if $trace is set to '2' (absolute server path, don't forget the prefacing and closing slashes "/"). If not set, no trace log is written.

Default:

Category: PT_TOOLS::MSGBOX [= configuration for class tx_pttools_msgBox]
MessageBox template file path

a

MessageBox template file path

b

[config.pt_tools.msgboxTemplate]

Path to the HTML template file for Message Boxes

a

Path to the HTML template file for Message Boxes

Default: EXT:pt_tools/res/tmpl/tx_pttools_msgBox.html

MessageBox icon directory

a

MessageBox icon directory

b

[config.pt_tools.msgboxIconDir]

Directory path for icons used in MessageBoxes (relative path based on

a

Directory path for icons used in MessageBoxes (relative path based on document root, like "fileadmin/...").

Default: EXT:pt_tools/res/img/

**NOTE** : The former configuration options "msgboxFontHeadline", "msgboxFontMsg", "msgboxColHeadlineBg", "msgboxColMsgBg" and "msgboxColBorder" have been removed since pt_tools version 0.3.0. The default messagebox styles are now defined in the extension's static template at plugin.pt_tools._CSS_DEFAULT_STYLE (defaults to be found in file pt_tools/static/setup.txt), use Typoscript to overwrite these settings with your individual style.

Category: PT_TOOLS::FORMCHECKER [= configuration for class tx_pttools_formchecker]
RegEx for checkText()

a

RegEx for checkText()

b

[config.pt_tools.fcRegex_checkText]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkText() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /pC/

RegEx for checkDigit()

a

RegEx for checkDigit()

b

[config.pt_tools.fcRegex_checkDigit]

Regular expression pattern (PCRE for preg_match()) to be used in

a

Regular expression pattern (PCRE for preg_match()) to be used in tx_pttools_formchecker::checkDigit() (if the preg_match() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /PN/

RegEx for checkFloat()

a

RegEx for checkFloat()

b

[config.pt_tools.fcRegex_checkFloat]

Regular expression pattern (PCRE for preg_match()) to be used in

a

Regular expression pattern (PCRE for preg_match()) to be used in tx_pttools_formchecker::checkFloat() (if the preg_match() expression returns not 0, the formchecker will throw an error message). Note: The decimal separator is not checked by RegEx here, but passed by param to checkFloat(). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl- Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /PN/

RegEx for checkTel()

a

RegEx for checkTel()

b

[config.pt_tools.fcRegex_checkTel]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkTel() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /[^pN.+ -/]/

RegEx for checkZip()

a

RegEx for checkZip()

b

[config.pt_tools.fcRegex_checkZip]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkZip() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /PN/

RegEx for checkLogin()

a

RegEx for checkLogin()

b

[config.pt_tools.fcRegex_checkLogin]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkLogin() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /[^a-z0-9!_-]/

RegEx for checkPwd()

a

RegEx for checkPwd()

b

[config.pt_tools.fcRegex_checkPwd]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkPwd() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /[^a-z0-9!_-]/

RegEx for checkEmail()

a

RegEx for checkEmail()

b

[config.pt_tools.fcRegex_checkEmail]

Regular expression pattern (* POSIX* Extended RE for

a

Regular expression pattern (* POSIX* Extended RE for !eregi()) to be used for * negated *(!) regex check in tx_pttools_formchecker::checkEmail() (if the '!eregi()' expression returns 1, the formchecker will throw an error message) - this setting has no effect if the method is called with the MX check param. WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [POSIX Extended Regular Expressions see http://www.tin.org/bin/man.cgi?section=7&topic=regex ]

Default: ^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,})$

RegEx for checkDomain()

a

RegEx for checkDomain()

b

[config.pt_tools.fcRegex_checkDomain]

Regular expression pattern (PCRE for preg_match_all()) to be used in

a

Regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkDomain() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /[^a-z0-9-]/

RegEx for checkFtp()

a

RegEx for checkFtp()

b

[config.pt_tools.fcRegex_checkFtp]

Regular expression pattern (PCRE for preg_match_all()) to be used

a

Regular expression pattern (PCRE for preg_match_all()) to be used for regex check in tx_pttools_formchecker::checkFtp() (if the preg_match_all() expression returns not 0, the formchecker will throw an error message) - note that the hardcoded strings '..' and './' will be checked independently of this regex. WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default: /[^a-z0-9!._#:-]/

RegEx for checkUserdefined1()

a

RegEx for checkUserdefined1()

b

[config.pt_tools.fcRegex_checkUserdefined1]

Optional user defined regular expression pattern (PCRE for

a

Optional user defined regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkUserdefined1() (no regex check will be executed for the method if this value is left blank - if the regex is set and the preg_match_all() expression returns 1, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default:

RegEx for checkUserdefined2()

a

RegEx for checkUserdefined2()

b

[config.pt_tools.fcRegex_checkUserdefined2]

Optional user defined regular expression pattern (PCRE for

a

Optional user defined regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkUserdefined2() (no regex check will be executed for the method if this value is left blank - if the regex is set and the preg_match_all() expression returns 1, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default:

RegEx for checkUserdefined3()

a

RegEx for checkUserdefined3()

b

[config.pt_tools.fcRegex_checkUserdefined3]

Optional user defined regular expression pattern (PCRE for

a

Optional user defined regular expression pattern (PCRE for preg_match_all()) to be used in tx_pttools_formchecker::checkUserdefined3() (no regex check will be executed for the method if this value is left blank - if the regex is set and the preg_match_all() expression returns 1, the formchecker will throw an error message). WARNING: An incorrect pattern entry will result in PHP errors in the frontend! [PHP's Perl-Compatible Regular Expression Patterns see http://www.php.net/manual/en/reference.pcre.pattern.syntax.php ]

Default:

Category: PT_TOOLS::FORMTEMPLATEHANDLER [= configuration for class tx_pttools_formTemplateHandler]
Form element templates file

a

Form element templates file

b

[config.pt_tools.fthElementTemplatesFilePath]

Path to the file containing templates for the different form element

a

Path to the file containing templates for the different form element types.

Default: EXT:pt_tools/res/tmpl/tx_pttools_formTemplateHandler.html

Javascript helper functions file

a

Javascript helper functions file

b

[config.pt_tools.fthJsHelperFilePath]

Path to the Javascript file with helper functions for form handling.

a

Path to the Javascript file with helper functions for form handling.

Default: EXT:pt_tools/res/js/tx_pttools_formTemplateHandler.js

Css file

a

Css file

b

[config.pt_tools.fthCssFilePath]

Path to the file with css definitions for form handling.

a

Path to the file with css definitions for form handling.

Default: EXT:pt_tools/res/css/tx_pttools_formTemplateHandler.css

Known problems

None so far.

To-Do list

  • Implement storing, reading and deleting data to foreign session in backend and frontend context in tx_pttools_sessionStorageAdapter
  • refactor tx_pttools_cliHandler
  • Add unit tests

Changelog

((generated))

v1.0.1:

removed SVN control directories for TER version

v1.0.0:
  • improved and extended available security tools in tx_pttools_div: added quoteStr() as a string quoting method to prevent SQL injections in TypoScript code (for usage as TS userFunction, see inline PHPdoc comment for example), improved existing XSS prevention methods htmlOutput() and htmlOutputArray(), added XSS prevention method htmlOutputArrayAccess() for automatic filtering of complete objects implementing PHP's ArrayAccess interface
  • added new payment API classes (to res/objects/): tx_pttools_paymentRequestInformation, tx_pttools_paymentReturnInformation
  • added new interfaces (to res/abstracts/): tx_pttools_iPageable, tx_pttools_iTemplateable, tx_pttools_iSettableByArray, tx_pttools_iQuickformRenderer, iSingletonCollection
  • added a templatable form renderer based on PEAR HTML_Quickform: added renderer interface res/abstract/class.tx_pttools_iQuickformRenderer.php, renderer class res/objects/class.tx_pttools_qfDefaultRenderer.php and renderer templates res/tmpl/tx_pttools_quickformRenderer*.html
  • added several new Smarty modifiers to res/smarty_plugins (stdWrap, explodeAndPrint, urlencode, convertDate, trace, registerValue, numberFormat, includeCssFile, includeJsFile)
  • added new toolbox methods to tx_pttools_div: hasGroupAccess(), isAssociativeArray(), isIntegerish(), stdWrapArray(), getLangObject() [use the latest if you need a lang object and don't want to care about the context you're in]
  • added new exception tx_pttools_exceptionNotImplemented (in res/objects/exceptions)
  • added new hooks in tx_pttools_div::localRedirect() (to allow things to be done before redirecting) and in tx_pttools_smartyAdapter::__construct() (to allow adding other locations for smarty plugin directories)
  • tx_pttools_finance::getFormattedPriceString() respects locale's thousands separator now
  • class.tx_pttools_assert.php: fixed isNotEmptyString() for usage with string '0', added assertion isAssociativeArray()
  • tx_pttools_smartyAdapter now reads language file from EXT:<extkey>/locallang.xml by default (instead of throwing an error if nothing is configured)
  • tx_pttools_debug (including global trace() method): ignores tx_pttools_exception inclusion in non TYPO3-mode now (thus allows to use the base class functions in any arbitrary context now), added exceptionToTxt() and extended catchUncaughtExceptionsExceptionHandler() to display exception in text format when in CLI mode
  • miscellaneous minor internal improvements, additions and fixes
v0.4.1:
  • Smarty: adapted compile and cache directories to the defaults of the current smarty extension (changed default initialisation for tx_pttools_smartyAdapter constructor, added default directory config in ext_localconf.php (may be overwritten individually); IMPORTANT : your extensions using Smarty should create the required directories with an appropriate entry in their emconf.php file (e.g. set 'createDirs' to 'typo3temp/smarty_cache,typo3temp/smarty_compile')
  • revision of tx_pttools_sessionStorageAdapter and tx_pttools_feUsersessionStorageAdapter: all methods no more dependent on $GLOBALS['TSFE'], but now on $GLOBALS['TSFE']->fe_user only - this allows you to use the adapters in the eID context as well (where we do not have a TSFE) by creating a FE user in your eID script (see chapter “Users manual” above)
  • tx_pttools_div::typoscriptRegistry(): bugfix for isValidUid() assertion, improved TSFE assertion
  • tx_pttools_div: added new method :getPeriodAsInt() to translate time periods to convert strings describing time periods to integers of given unit
  • tx_pttools_assert:
  • isMySQLRessource() works with other t3lib_db objects now, added new optional parameter in-between(!)
  • isType(): marked as deprecated now (use isInstanceOf() instead)
  • added some new assertions to tx_pttools_assert: isNotNull(), isPositiveInteger(), isValidEmail(), loggedIn()
  • tx_pttools_formTemplateHandler allows arbitrary JavaScript event handlers for all kinds of inputs now
  • miscellaneous internal improvements (tx_pttools_div::mergeConfAndFlexform(), tx_pttools_div::returnExtConfArray(), tx_pttools_div::hookRequest(), tx_pttools_exceptionDatabase::__construct(), tx_pttools_debug::trace(), faketsfe.inc.php) and logging additions
v0.4.0:
  • major revision of Smarty integration: complete re-write of tx_pttools_smartyAdapter (fully backwards compatible), added new class res/objects/class.tx_pttools_smartyCompiler.php, added directory “smarty_plugins” (containing additional modifiers and callback functions for usage with the Smarty templating engine, e.g. a modifier to access TYPO3 locallang labels directly from the Smarty template)
  • major revision of the collection concept: added new abstract class tx_pttools_collection for arbitrary item collections, new class contains most (slightly modified) methods of former tx_pttools_objectCollection, tx_pttools_objectCollection now extends tx_pttools_collection and provides object related functionality only, tx_pttools_registry now extends new abstract class tx_pttools_collection to allow arbitrary registry entries; fixed bug if no search value was given to collection method keys()
  • added new debugging features: added extension configuration option “convertErrorsToExceptions” and “catchUncaughtExceptions” in extension manager, added appropriate set_*_Handler in ext_localconf.php and new tx_pttools_debug methods convertErrorToExceptionErrorHandler() and catchUncaughtExceptionsExceptionHandler(). Using these new options you're enabled to catch errors and uncaught exceptions and display them with a nice backtrace (for details refer to the EM's option descriptions). In combination with TYPO3's "systemLog" these options can provide a mighty tool while developing and for monitoring
  • improvements of formTemplateHandler: fixed textarea handling bug, added left.gif (copied from Apache icons), buttons now can have an arbitrary number of event handlers, clickbuttons allowed now, improved form elements checks, FTH manual extended for Javascript functions, added form sections (via SECTIONSTART and SECTIONEND)
  • added cookie check method tx_pttools_div::checkCookies() and new TS option cookieErrorPage in Constant Editor for this method
  • tx_pttools_div: fixed bug in returnTyposcriptSetup() (if TSFE is incompletely loaded, e.g. with preBeUser hook), revised hookRequest(), added new methods typoscriptRegistry(), getTS(), clearCache(), sanitizeIntList()
  • tx_pttools_debug: removed method backtraceErrorHandler(), added new method cleanBacktrace(), extended inDevContext() (BE admins are in dev context by default now), adapted default CSS path in exceptionToHTML(), improved trace()
  • improvements of tx_pttools_finance: getFormattedPriceString() configurable now (added new TS option currencyFormat in Constant Editor), getFormattedPriceString() now separates decimal places using "." or "," depending on locale
  • tx_pttools_assert: fixed bug in matchesPattern(), added some new assertion methods, miscellaneous improvements
  • tx_pttools_formchecker: added new methods checkNone(), checkMultiselect()
  • tx_pttools_cliHandler: added new method readFileRelToCliScript()
  • tx_pttools_formReloadHandler: converted all methods to static methods
  • tx_pttools_exception: added new method handle(), use this from now on instead of now deprecated method handleException()
  • inc/faketsfe.inc.php: fake TSFE provides a cObj now
  • minor internal improvements and logging additions, added some French locallang labels for formchecker
v0.3.0:
  • major revision of tx_pttools_msgBox: removed inline CSS styles and icon related constants - default messagebox styles are now defined in the extension's static template at plugin.pt_tools._CSS_DEFAULT_STYLE to allow overriding with individual styles by Typoscript; removed inheritance from tslib_pibase (removed inherited properties scriptRelPath und extKey, changed language handling); calling an invalid messagebox type throws an exception now (instead of former display of the error within the messagebox) IMPORTANT : Styling of the "tx_pttools_msgBox" has changed - if you did not use the default values for the former (and henceforth no more used) Constant Editor/Typoscript parameters "msgboxFontHeadline", "msgboxFontMsg", "msgboxColHeadlineBg", "msgboxColMsgBg" or "msgboxColBorder", you have to apply your differing settings by adapting the default styles now defined in the extension's static template at "plugin.pt_tools._CSS_DEFAULT_STYLE" (defaults to be found in file pt_tools/static/setup.txt)!
  • major revision of tx_pttools_objectCollection: implementation of SPL ArrayAccess interface; made property selectedId permanently available now; added new methods, exceptions and improvements
  • major revision of exception handling (all changes are backwards compatible): added new classes in res/objects/exceptions for each special exception case of tx_pttools_exception (public usage of tx_pttools_exception's 2nd constructor parameter and EXCP_* constants are deprecated now!); exceptions are logged in devlog, sysLog and tsLog now; getter methods added to tx_pttools_exception
  • revision of tx_pttools_formchecker: removed inheritance from tslib_pibase and inherited properties scriptRelPath und extKey, changed language handling for all check methods
  • added assertion handling: new class res/staticlib/class.tx_pttools_assert.php for miscellaneous assertions, new class res/objects/exceptions/tx_pttools_exceptionAssertion for failed assertions
  • added Registry design pattern implementation: new class res/objects/class.tx_pttools_registry.php
  • added new class res/objects/class.tx_pttools_collectionElementSelector.php (see doc/manual_collectionElementSelector.txt for details)
  • improved exception output possibilities for developers by adding new tx_pttools_debug methods getCodeSnippet(), exceptionToHTML() and traceToHtml() + new CSS file res/tmpl/exception.css
  • tx_pttools_formTemplateHandler: fixed bug with hidden fields, added SplitDate input field processing
  • tx_pttools_div: added new methods getPid(), outputToPopup() and inDevContext() (see inline comments for documentation), new optional param for mergeConfAndFlexform() to avoid exceptions
  • tx_pttools_beSubmodule now allows also non-admins to access the backend modules
  • raised TYPO3 dependency to version 4.0+
  • minor internal improvements and bugfixes, converted locallang file in res/objects to XML
v0.2.5:
  • tx_pttools_formchecker: changed default patterns in static/constants.txt to fix UTF-8 German umlaut problems on Linux
  • tx_pttools_formchecker and tx_pttools_formTemplateHandler: fixed length check bug for UTF-8
  • tx_pttools_msgBox: moved hardcoded message box HTML code to template file (configurable via TypoScript/Constant Editor), removed obsolete function generateMsgBoxHTML_OLD()
  • tx_pttools_div::returnTyposcriptSetup() now usable for eID scripts, too
  • tx_pttools_beSubmodule::printSearchForm: added parameter configuration for method
  • tx_pttools_div::readLLfile(): added exception if $GLOBALS['LANG'] is no object
  • changed visibility of miscellaneous object properties and methods from “private” to “protected” for better support of OOP inheritance
v0.2.4:
  • added this manual and changelog
  • overhaul of tx_pttools_exception (general cleanup, error code constants added)
  • fix in faketsfe.inc.php, imrovement of tx_pttools_div::mergeConfAndFlexform()

img-3 EXT: punkt.de Tools (pt_tools) - 12