This is the API documentation for the t3lib/ directory contents.
Many of these classes are possible to use in your own applications with TYPO3.
In any case you should read the notices for the files / classes first.
For practical uses of these APIs you should look for the document
"TYPO3 Core API" (new with TYPO3 3.6.0) since this will point you to
the functions which you might find useful.
Here is a few highlights from this library:
For writing extensions, the file class.t3lib_extMgm.php contains
various API functions for adding modules, tables, fields, and other
configuration options, mostly from ext_tables.php and ext_localconf.php
files.
General purpose functions for usage in both frontend and backend (often
functions not specific to TYPO3) can be found in class.t3lib_div.php -
please look into this class!
For backend programming (modules etc) the file class.t3lib_befunc.php
contains functions - notice, they cannot be used from the frontend!
Files: 43
Total filesizes: 1.3 Mbytes
Functions and classes: 989
This
class holds functions used by the TYPO3 backend to check the integrity
of the database (The DBint module, 'lowlevel' extension)
Depends on: Depends on loaddbgroup from t3lib/
@todo: Need to really extend this class when the tcemain library has been updated and the whole API is better defined. There are some known bugs in this library. Further it would be nice with a facility to not only analyze but also clean up!
@package: TYPO3
@subpackage: t3lib
Class for displaying an array as a tree
See the extension 'lowlevel' /config (Backend module 'Tools > Configuration')
@package: TYPO3
@subpackage: t3lib
Contains functions for management, validation etc of files in TYPO3, using the concepts of web- and ftp-space. Please see the comment for the init() function
@package: TYPO3
@subpackage: t3lib
This class holds some functions used to display the sys_log table-content.
Used in the status-scripts and the log-module.
@package: TYPO3
@subpackage: t3lib
Standard functions available for the TYPO3 backend.
Don't instantiate - call functions with "t3lib_BEfunc::" prefixed the function name.
@package: TYPO3
@subpackage: t3lib
TYPO3 user authentication, backend
Could technically have been the same class as t3lib_userauthgroup since these two are always used together and only together.
t3lib_userauthgroup contains most of the functions used for checking
permissions, authenticating users, setting up the user etc. This class
is most interesting in terms of an API for user from outside.
This class contains the configuration of the database fields used plus
some functions for the authentication process of backend users.
@package: TYPO3
@subpackage: t3lib
Extension class for the t3lib_treeView class, specially made for browsing pages
@package: TYPO3
@subpackage: t3lib
TYPO3 clipboard for records and files
@package: TYPO3
@subpackage: t3lib
Class for conversion between charsets.
@package: TYPO3
@subpackage: t3lib
TYPO3 "database wrapper" class (new in 3.6.0)
This class contains
- abstraction functions for executing INSERT/UPDATE/DELETE/SELECT
queries ("Query execution"; These are REQUIRED for all future
connectivity to the database, thus ensuring DBAL compliance!)
- functions for building SQL queries (INSERT/UPDATE/DELETE/SELECT)
("Query building"); These are transitional functions for building SQL
queries in a more automated way. Use these to build queries instead of
doing it manually in your code!
- mysql() wrapper functions; These are transitional functions. By a
simple search/replace you should be able to substitute all mysql*()
calls with $GLOBALS['TYPO3_DB']->sql*() and your application will
work out of the box. YOU CANNOT (legally) use any mysql functions not
found as wrapper functions in this class!
See the Project Coding Guidelines (doc_core_cgl) for more instructions on best-practise
This class is not in itself a complete database abstraction layer but
can be extended to be a DBAL (by extensions, see "dbal" for example)
ALL connectivity to the database in TYPO3 must be done through this class!
The points of this class are:
- To direct all database calls through this class so it becomes possible to implement DBAL with extensions.
- To keep it very easy to use for developers used to MySQL in PHP - and
preserve as much performance as possible when TYPO3 is used with MySQL
directly...
- To create an interface for DBAL implemented by extensions; (Eg.
making possible escaping characters, clob/blob handling, reserved words
handling)
- Benchmarking the DB bottleneck queries will become much easier; Will make it easier to find optimization possibilities.
USE:
In all TYPO3 scripts the global variable $TYPO3_DB is an instance of this class. Use that.
Eg. $GLOBALS['TYPO3_DB']->sql_fetch_assoc()
@package: TYPO3
@subpackage: t3lib
This class has functions which generates a difference output of a content string
Currently works only with LINUX/UNIX
@package: TYPO3
@subpackage: t3lib
The legendary "t3lib_div" class - Miscellaneous functions for general purpose.
Most of the functions does not relate specifically to TYPO3
However a section of functions requires certain TYPO3 features available
See comments in the source.
You are encouraged to use this library in your own scripts!
USE:
The class is intended to be used without creating an instance of it.
So: Don't instantiate - call functions with "t3lib_div::" prefixed the function name.
So use t3lib_div::[method-name] to refer to the functions, eg. 't3lib_div::milliseconds()'
@package: TYPO3
@subpackage: t3lib
@todo: Possible improvement: Should it rawurldecode the string first to check if any of these characters is encoded ?
Extension Management functions
This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');
@package: TYPO3
@subpackage: t3lib
Parent class for 'Extension Objects' in backend modules.
Used for 'submodules' to other modules. Also called 'Function menu
modules' in t3lib_extMgm. And now its even called 'Extension Objects'.
Or 'Module functions'. Wish we had just one name. Or a name at
all...(?) Thank God its not so advanced when it works...
In other words this class is used for backend modules which is not true
backend modules appearing in the menu but rather adds themselves as a
new entry in the function menu which typically exists for a backend
module (like Web>Functions, Web>Info or Tools etc...)
The magic that binds this together is stored in the global variable
$TBE_MODULES_EXT where extensions wanting to connect a module based on
this class to an existing backend module store configuration which
consists of the classname, script-path and a label (title/name)
For more information about this, please see the large example comment
for the class t3lib_SCbase. This will show the principle of a 'level-1'
connection.
The more advanced example - having two layers as it is done by the
'func_wizards' extension with the 'web_info' module - can be seen in
the comment above.
@package: TYPO3
@subpackage: t3lib
Extension class for the t3lib_treeView class, specially made for browsing folders in the File module
@package: TYPO3
@subpackage: t3lib
Formmail class, used by the TYPO3 "cms" extension (default frontend) to send email forms.
@package: TYPO3
@subpackage: t3lib
Icon generation, backend
This library has functions that returns - and if necessary creates - the icon for an element in TYPO3
Expects global vars:
- $BACK_PATH
- PATH_typo3
- $TCA, $PAGES_TYPES
Notes:
These functions are strongly related to the interface of TYPO3.
The class is included in eg. init.php
ALL functions called without making a class instance, eg. "t3lib_iconWorks::getIconImage()"
@package: TYPO3
@subpackage: t3lib
Load database groups (relations)
Used to process the relations created by the TCA element types "group"
and "select" for database records. Manages MM-relations as well.
@package: TYPO3
@subpackage: t3lib
Load Backend Interface modules
Typically instantiated like this:
$this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
$this->loadModules->load($TBE_MODULES);
@package: TYPO3
@subpackage: t3lib
Matching TypoScript conditions
Used with the TypoScript parser.
Matches browserinfo, IPnumbers for use with templates
@package: TYPO3
@subpackage: t3lib
Page functions, a lot of sql/pages-related functions
Mainly used in the frontend but also in some cases in the backend.
It's important to set the right $where_hid_del in the object so that the functions operate properly
@package: TYPO3
@subpackage: t3lib
Class for generating a page tree.
@package: TYPO3
@subpackage: t3lib
Functions for parsing HTML.
You are encouraged to use this class in your own applications
@package: TYPO3
@subpackage: t3lib
Class for parsing HTML for the Rich Text Editor. (also called transformations)
@package: TYPO3
@subpackage: t3lib
Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
Used for pages / tt_content element wizards of various kinds.
@package: TYPO3
@subpackage: t3lib
Functions used to read email content
The class is still just a bunch of miscellaneous functions used to read content out of emails
@package: TYPO3
@subpackage: t3lib
This class is the base for listing of database records and files in the modules Web>List and File>Filelist
@package: TYPO3
@subpackage: t3lib
Parent class for 'ScriptClasses' in backend modules.
See example comment above.
@package: TYPO3
@subpackage: t3lib
PHP SQL engine / server
@package: TYPO3
@subpackage: t3lib
@todo: Table locking tools?
@todo: Table locking tools?
@package: TYPO3
@subpackage: t3lib
Class contains a bunch of cool functions for manipulating graphics with GDlib/Freetype and ImageMagick
VERY OFTEN used with gifbuilder that extends this class and provides a TypoScript API to using these functions
@package: TYPO3
@subpackage: t3lib
Super Admin class has functions for the administration of multiple TYPO3 sites in folders
See 'misc/superadmin.php' for details on how to use!
$Id: t3lib_api.html,v 1.2 2004/03/22 16:37:55 typo3 Exp $
Revised for TYPO3 3.6 February/2004 by Kasper Skaarhoj
XHTML Compliant
@package: TYPO3
@subpackage: t3lib
Syntax Highlighting class.
@package: TYPO3
@subpackage: t3lib
'TCEforms' - Class for creating the backend editing forms.
@package: TYPO3
@subpackage: t3lib
Frontend Timetracking functions
Is used to register how much time is used with operations in TypoScript
Used by index_ts
@package: TYPO3
@subpackage: t3lib
Class for getting and transforming data for display in backend forms (TCEforms)
@package: TYPO3
@subpackage: t3lib
Base class for creating a browsable array/page/folder tree in HTML
@package: TYPO3
@subpackage: t3lib
TYPO3 backend user authentication in the TSFE frontend.
This includes mainly functions related to the Admin Panel
@package: TYPO3
@subpackage: t3lib
The TypoScript parser
@package: TYPO3
@subpackage: t3lib
Template object that is responsible for generating the TypoScript template based on template records.
@package: TYPO3
@subpackage: t3lib
@todo: Apply caching to the parsed Page TSconfig. This is done in the other similar functions for both frontend and backend. However, since this functions works for BOTH frontend and backend we will have to either write our own local caching function or (more likely) detect if we are in FE or BE and use caching functions accordingly. Not having caching affects mostly the backend modules inside the "Template" module since the overhead in the frontend is only seen when TypoScript templates are parsed anyways (after which point they are cached anyways...)
Authentication of users in TYPO3
This class is used to authenticate a login user.
The class is used by both the frontend and backend. In both cases this class is a parent class to beuserauth and feuserauth
See Inside TYPO3 for more information about the API of the class and internal variables.
@package: TYPO3
@subpackage: t3lib
Extension to class.t3lib_userauth.php; Authentication of users in TYPO3 Backend
Actually this class is extended again by t3lib_beuserauth which is the actual backend user class that will be instantiated.
In fact the two classes t3lib_beuserauth and this class could just as
well be one, single class since t3lib_userauthgroup is not - to my
knowledge - used separately elsewhere. But for historical reasons they
are two separate classes.
@package: TYPO3
@subpackage: t3lib
XML class, Used to create XML output from input rows.
Doesn't contain a lot of advanced features - pretty straight forward, practical stuff
You are encouraged to use this class in your own applications.
@package: TYPO3
@subpackage: t3lib
Class for generating a thumbnail from the input parameters given to the script
Input GET var, &file: relative or absolute reference to an imagefile. WILL be validated against PATH_site / lockRootPath
Input GET var, &size: integer-values defining size of thumbnail, format '[int]' or '[int]x[int]'
Relative paths MUST BE the first two characters ONLY: eg: '../dir/file.gif', otherwise it is expect to be absolute
@package: TYPO3
@subpackage: t3lib
This
class holds functions used by the TYPO3 backend to check the integrity
of the database (The DBint module, 'lowlevel' extension)
Depends on: Depends on loaddbgroup from t3lib/
Filesize: | 19.2 K |
Func/Classes: | 13 |
Tags: | @todo
Need to really extend this class when the tcemain library has been
updated and the whole API is better defined. There are some known bugs
in this library. Further it would be nice with a facility to not only
analyze but also clean up! @see SC_mod_tools_dbint_index::func_relations(), SC_mod_tools_dbint_index::func_records() @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
This
class holds functions used by the TYPO3 backend to check the integrity
of the database (The DBint module, 'lowlevel' extension)
Depends on: Depends on loaddbgroup from t3lib/
Returns: | [type] | ... |
@todo Need to really extend this class when the tcemain library has been updated and the whole API is better defined. There are some known bugs in this library. Further it would be nice with a facility to not only analyze but also clean up! | ||
@see SC_mod_tools_dbint_index::func_relations(), SC_mod_tools_dbint_index::func_records() | ||
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Generates a list of Page-uid's that corresponds to the tables in the tree. This list should ideally include all records in the pages-table.
$theID | integer | a pid (page-record id) from which to start making the tree |
$depthData | string | HTML-code (image-tags) used when this function calls itself recursively. |
Returns: | integer | Number of $GLOBALS['TYPO3_DB']->sql_num_rows (most recent query) |
Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.
$pid_list | string | list of pid's (page-record uid's). This list is probably made by genTree() |
Returns: | void |
Fixes lost record from $table with uid $uid by setting the PID to zero. If there is a disabled column for the record that will be set as well.
$table | string | Database tablename |
$uid | integer | The uid of the record which will have the PID value set to 0 (zero) |
Returns: | boolean | True if done. |
Counts records from $TCA-tables that ARE attached to an existing page.
$pid_list | string | list of pid's (page-record uid's). This list is probably made by genTree() |
Returns: | array | an array with the number of records from all $TCA-tables that are attached to a PID in the pid-list. |
Finding relations in database based on type 'group' (files or database-uid's in a list)
$mode | string | $mode = file, $mode = db, $mode = '' (all...) |
Returns: | array | An array with all fields listed that somehow are references to other records (foreign-keys) or files |
Finds all fields that hold filenames from uploadfolder
$uploadfolder | string | Path to uploadfolder |
Returns: | array | An array with all fields listed that have references to files in the $uploadfolder |
Returns an array with arrays of table/field pairs which are allowed to hold references to the input table name - according to $TCA
$theSearchTable | string | Table name |
Returns: | array |
This selects non-empty-records from the tables/fields in the fkey_array generated by getGroupFields()
$fkey_arrays | array | Array with tables/fields generated by getGroupFields() |
Returns: | void | |
@see getGroupFields() |
Depends on selectNonEmpty.... to be executed first!!
Returns: | array | Report over files; keys are "moreReferences", "noReferences", "noFile", "error" |
Depends on selectNonEmpty.... to be executed first!!
$theArray | array | Table with key/value pairs being table names and arrays with uid numbers |
Returns: | string | HTML Error message |
Finding all references to record based on table/uid
$searchTable | string | Table name |
$id | integer | Uid of database record |
Returns: | array | Array with other arrays containing information about where references was found |
Finding all references to file based on uploadfolder / filename
$uploadfolder | string | Upload folder where file is found |
$filename | string | Filename to search for |
Returns: | array | Array with other arrays containing information about where references was found |
Class for displaying an array as a tree
See the extension 'lowlevel' /config (Backend module 'Tools > Configuration')
Filesize: | 7.2 K |
Func/Classes: | 5 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see SC_mod_tools_config_index::main() |
Class for displaying an array as a tree
See the extension 'lowlevel' /config (Backend module 'Tools > Configuration')
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see SC_mod_tools_config_index::main() |
Make browsable tree
Before calling this function you may want to set some of the internal
vars like depthKeys, regexMode and fixedLgd. For examples see
SC_mod_tools_config_index::main()
$arr | array | The array to display |
$depth_in | string | Key-position id. Build up during recursive calls - [key1].[key2].[key3] - an so on. |
$depthData | string | Depth-data - basically a prefix for the icons. For calling this function from outside, let it stay blank. |
Returns: | string | HTML for the tree |
@see SC_mod_tools_config_index::main() |
Creates an array with "depthKeys" which will expand the array to show the search results
$keyArr | array | The array to search for the value |
$depth_in | string | Depth string - blank for first call (will build up during recursive calling creating an id of the position: [key1].[key2].[key3] |
$searchString | string | The string to search for |
$keyArray | array | Key array, for first call pass empty array |
Returns: | array |
Fixed length function
$string | string | String to process |
$chars | integer | Max number of chars |
Returns: | string | Processed string |
Function modifying the depthKey array
$arr | array | Array with instructions to open/close nodes. |
$settings | array | Input depth_key array |
Returns: | array | Output depth_key array with entries added/removed based on $arr |
@see SC_mod_tools_config_index::main() |
Contains functions for management, validation etc of files in TYPO3, using the concepts of web- and ftp-space. Please see the comment for the init() function
Filesize: | 17.2 K |
Func/Classes: | 19 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_basicFileFunctions::init() |
Contains functions for management, validation etc of files in TYPO3, using the concepts of web- and ftp-space. Please see the comment for the init() function
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_basicFileFunctions::init() |
Constructor
This function should be called to initialise the internal arrays $this->mounts and $this->f_ext
A typical example of the array $mounts is this:
$mounts[xx][path] = (..a mounted path..)
the 'xx'-keys is just numerical from zero. There are also a [name] and
[type] value that just denotes the mountname and type. Not used for
athentication here.
$this->mounts is traversed in the function
checkPathAgainstMounts($thePath), and it is checked that $thePath is
actually below one of the mount-paths
The mountpaths are with a trailing '/'. $thePath must be with a trailing '/' also!
As you can see, $this->mounts is very critical! This is the array
that decides where the user will be allowed to copy files!!
Typically the global var $WEBMOUNTS would be passed along as $mounts
A typical example of the array $f_ext is this:
$f_ext['webspace']['allow']='';
$f_ext['webspace']['deny']='php3,php';
$f_ext['ftpspace']['allow']='*';
$f_ext['ftpspace']['deny']='';
The control of fileextensions goes in two catagories. Webspace and
Ftpspace. Webspace is folders accessible from a webbrowser (below
TYPO3_DOCUMENT_ROOT) and ftpspace is everything else.
The control is done like this: If an extension matches 'allow' then the
check returns true. If not and an extension matches 'deny' then the
check return false. If no match at all, returns true.
You list extensions comma-separated. If the value is a '*' every extension is allowed
The list is case-insensitive when used in this class (see init())
Typically TYPO3_CONF_VARS['BE']['fileExtensions'] would be passed along as $f_ext.
Example:
$basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
$mounts | array | Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $BE_USER->returnFilemounts(); (see typo3/init.php) |
$f_ext | array | Array with information about allowed and denied file extensions. Typically passed: $TYPO3_CONF_VARS['BE']['fileExtensions'] |
Returns: | void | |
@see typo3/init.php, t3lib_userAuthGroup::returnFilemounts() |
Returns an array with a whole lot of fileinformation.
$wholePath | string | Filepath to existing file. Should probably be absolute. Filefunctions are performed on this value. |
Returns: | array | Information about the file in the filepath |
Checks if a $iconkey (fileextension) is allowed according to $this->f_ext.
$iconkey | string | The extension to check, eg. "php" or "html" etc. |
$type | string | Either "webspage" or "ftpspace" - points to a key in $this->f_ext |
Returns: | boolean | True if file extension is allowed. |
Returns true if you can operate of ANY file ('*') in the space $theDest is in ('webspace' / 'ftpspace')
$theDest | string | Absolute path |
Returns: | boolean |
Checks if $this->webPath (should be TYPO3_DOCUMENT_ROOT) is in the first part of $path
Returns true also if $this->init is not set or if $path is empty...
$path | string | Absolute path to check |
Returns: | boolean |
If the filename is given, check it against the TYPO3_CONF_VARS[BE][fileDenyPattern] +
Checks if the $ext fileextension is allowed in the path $theDest (this
is based on whether $theDest is below the $this->webPath)
$ext | string | File extension, eg. "php" or "html" |
$theDest | string | Absolute path for which to test |
$filename='' | string | Filename to check against TYPO3_CONF_VARS[BE][fileDenyPattern] |
Returns: | boolean | True if extension/filename is allowed |
Returns true if the input filename string is shorter than $this->maxInputNameLen.
$fileName | string | Filename, eg "somefile.html" |
Returns: | boolean |
Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.
$theDir | string | Directory path to check |
Returns: | string | Returns the cleaned up directory name if OK, otherwise false. |
Wrapper for t3lib_div::validPathStr()
$theFile | string | Filepath to evaluate |
Returns: | boolean | True, if no '//', '..' or '\' is in the $theFile |
@see t3lib_div::validPathStr() |
Returns the destination path/filename of a unique filename/foldername in that path.
If $theFile exists in $theDest (directory) the file have numbers
appended up to $this->maxNumber. Hereafter a unique string will be
appended.
This function is used by fx. TCEmain when files are attached to records and needs to be uniquely named in the uploads/* folders
$theFile | string | The input filename to check |
$theDest | string | The directory for which to return a unique filename for $theFile. $theDest MUST be a valid directory. Should be absolute. |
$dontCheckForUnique=0 | boolean | If set the filename is returned with the path prepended without checking whether it already existed! |
Returns: | string | The destination absolute filepath (not just the name!) of a unique filename/foldername in that path. |
@see t3lib_TCEmain::checkValue() |
Checks if $thePath is a path under one of the paths in $this->mounts
See comment in the header of this class.
$thePath | string | $thePath MUST HAVE a trailing '/' in order to match correctly with the mounts |
Returns: | string | The key to the first mount found, otherwise nothing is returned. |
@see init() |
Removes filemount part of a path, thus blinding the position.
Takes a path, $thePath, and removes the part of the path which equals the filemount.
$thePath | string | $thePath is a path which MUST be found within one of the internally set filemounts, $this->mounts |
Returns: | string | The processed input path |
Find temporary folder
Finds the first $this->tempFN ('_temp_' usually) -folder in the internal array of filemounts, $this->mounts
Returns: | string | Returns the path if found, otherwise nothing if error. |
Removes all dots, slashes and spaces after a path...
$theDir | string | Input string |
Returns: | string | Output string |
Converts any double slashes (//) to a single slash (/)
$string | string | Input value |
Returns: | string | Returns the converted string |
Returns a string which has a slash '/' appended if it doesn't already have that slash
$path | string | Input string |
Returns: | string | Output string with a slash in the end (if not already there) |
Returns a string where any character not matching [.a-zA-Z0-9_-] is substituted by '_'
$fileName | string | Input string, typically the body of a filename |
Returns: | string | Output string with any characters not matching [.a-zA-Z0-9_-] is substituted by '_' |
Formats an integer, $sizeInBytes, to Mb or Kb or just bytes
$sizeInBytes | integer | Bytes to be formated |
Returns: | string | Formatted with M,K or appended. |
This class holds some functions used to display the sys_log table-content.
Used in the status-scripts and the log-module.
Filesize: | 7.6 K |
Func/Classes: | 11 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see tx_belog_webinfo, SC_mod_tools_log_index |
This class holds some functions used to display the sys_log table-content.
Used in the status-scripts and the log-module.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see tx_belog_webinfo, SC_mod_tools_log_index |
Get time label for log listing
$code | integer | Timestamp to display |
Returns: | string | If the timestamp was also shown last time, then "." is returned. Otherwise the new timestamp formatted with ->doc->formatTime() |
Get user name label for log listing
$code | integer | be_user uid |
Returns: | string | If username is different from last username then the username, otherwise "." |
Get type label for log listing
$code | string | Key for the type label in locallang |
Returns: | string | If labe is different from last type label then the label is returned, otherwise "." |
Get action label for log listing
$code | string | Key for the action label in locallang |
Returns: | string | If labe is different from last action label then the label is returned, otherwise "." |
Get details for the log entry
$code | string | Suffix to "msg_" to get label from locallang. |
$text | string | Details text |
$data | array | Data array |
$sys_log_uid=0 | integer | sys_log uid number |
Returns: | string | Text string |
@see formatDetailsForList() |
Formats input string in red-colored font tags
$sign | string | Input value |
Returns: | string | Input wrapped in red font-tag and bold |
@obsolete |
Formatting details text for the sys_log row inputted
$row | array | sys_log row |
Returns: | string | Details string |
For
all entries in the $inArray (expected to be filepaths) the basename is
extracted and set as value (if $this->stripPath is set)
This is done for log-entries from the FILE modules
$inArr | array | Array of file paths |
Returns: | array | |
@see formatDetailsForList() |
Standard functions available for the TYPO3 backend.
Don't instantiate - call functions with "t3lib_BEfunc::" prefixed the function name.
Filesize: | 100 K |
Func/Classes: | 79 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Standard functions available for the TYPO3 backend.
Don't instantiate - call functions with "t3lib_BEfunc::" prefixed the function name.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns
the WHERE clause " AND NOT [tablename].[deleted-field]" if a
deleted-field is configured in $TCA for the tablename, $table
This function should ALWAYS be called in the backend for selection on
tables which are configured in TCA since it will ensure consistent
selection of records, even if they are marked deleted (in which case
the system must always treat them as non-existent!)
In the frontend a function, ->enableFields(), is known to filter
hidden-field, start- and endtime and fe_groups as well. But that is a
job of the frontend, not the backend. If you need filtering on those
fields as well in the backend you can use ->BEenableFields() though.
Usage: 80
$table | string | Table name present in $TCA |
Returns: | string | WHERE clause for filtering out deleted records, eg " AND NOT tablename.deleted" |
Gets record with uid=$uid from $table
You can set $field to a list of fields (default is '*')
Additional WHERE clauses can be added by $where (fx. ' AND blabla=1')
Will automatically check if records has been deleted and if so, not return anything.
$table must be found in $TCA
Usage: 168
$table | string | Table name present in $TCA |
$uid | integer | UID of record |
$fields='*' | string | List of fields to select |
$where='' | string | Additional WHERE clause, eg. " AND blablabla=0" |
Returns: | array | Returns the row if found, otherwise nothing |
Returns the first record found from $table with $where as WHERE clause
This function does NOT check if a record has the deleted flag set.
$table does NOT need to be configured in $TCA
The query used is simply this:
$query='SELECT '.$fields.' FROM '.$table.' WHERE '.$where;
Usage: 5 (ext: sys_todos)
$table | string | Table name (not necessarily in TCA) |
$where='' | string | WHERE clause |
$fields='*' | string | $fields is a list of fields to select, default is '*' |
Returns: | array | First row found, if any |
Returns records from table, $theTable, where a field ($theField) equals the value, $theValue
The records are returned in an array
If no records were selected, the function returns nothing
Usage: 8
$theTable | string | Table name present in $TCA |
$theField | string | Field to select on |
$theValue | string | Value that $theField must match |
$whereClause='' | string | Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy='' | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy='' | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit='' | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | mixed | Multidimensional array with selected records (if any is selected) |
Returns
a WHERE clause which will make an AND search for the words in the
$searchWords array in any of the fields in array $fields.
Usage: 1 (class t3lib_fullsearch)
$searchWords | array | Array of search words |
$fields | array | Array of fields |
$table='' | string | Table in which we are searching (for DBAL detection of quoteStr() method) |
Returns: | string | WHERE clause for search |
@depreciated Use $GLOBALS['TYPO3_DB']->searchQuery() directly! |
Returns a WHERE clause that can find a value ($value) in a list field ($field)
For instance a record in the database might contain a list of numbers,
"34,234,5" (with no spaces between). This query would be able to select
that record based on the value "34", "234" or "5" regardless of their
positioni in the list (left, middle or right).
Is nice to look up list-relations to records or files in TYPO3 database tables.
Usage: 3
$field | string | Table field name |
$value | string | Value to find in list |
Returns: | string | WHERE clause for a query |
@depreciated Use $GLOBALS['TYPO3_DB']->listQuery() directly! |
Makes an backwards explode on the $str and returns an array with ($table,$uid).
Example: tt_content_45 => array('tt_content',45)
Usage: 1
$str | string | [tablename]_[uid] string to explode |
Returns: | array |
Returns a list of pure integers based on $in_list being a list of records with table-names prepended.
Ex: $in_list = "pages_4,tt_content_12,45" would result in a return
value of "4,45" if $tablename is "pages" and $default_tablename is
'pages' as well.
Usage: 1 (t3lib_userauthgroup)
$in_list | string | Input list |
$tablename | string | Table name from which ids is returned |
$default_tablename | string | $default_tablename denotes what table the number '45' is from (if nothing is prepended on the value) |
Returns: | string | List of ids |
Backend implementation of enableFields()
Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.
Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition.
$GLOBALS["SIM_EXEC_TIME"] is used for date.
Usage: 5
$table | string | $table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $TCA. |
$inv=0 | boolean | $inv means that the query will select all records NOT VISIBLE records (inverted selection) |
Returns: | string | WHERE clause part |
Returns a SELECT query, selecting fields ($select) from two/three tables joined
$local_table and $mm_table is mandatory. $foreign_table is optional.
The JOIN is done with [$local_table].uid <-->
[$mm_table].uid_local / [$mm_table].uid_foreign <-->
[$foreign_table].uid
The function is very useful for selecting MM-relations between tables
adhering to the MM-format used by TCE (TYPO3 Core Engine). See the
section on $TCA in Inside TYPO3 for more details.
DEPRECIATED - Use $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query()
instead since that will return the result pointer while this returns
the query. Using this function may make your application less fitted
for DBAL later.
$select | string | Field list for SELECT |
$local_table | string | Tablename, local table |
$mm_table | string | Tablename, relation table |
$foreign_table | string | Tablename, foreign table |
$whereClause='' | string | Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy='' | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy='' | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit='' | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | string | Full SQL query |
@depreciated | ||
@see t3lib_DB::exec_SELECT_mm_query() |
Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
DEPRECIATED - $GLOBALS['TYPO3_DB']->INSERTquery() directly instead!
But better yet, use $GLOBALS['TYPO3_DB']->exec_INSERTquery()
$table | string | Table name |
$fields_values | array | Field values as key=>value pairs. |
Returns: | string | Full SQL query for INSERT |
@depreciated |
Creates
an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...')
from the array with field/value pairs $fields_values.
DEPRECIATED - $GLOBALS['TYPO3_DB']->UPDATEquery() directly instead!
But better yet, use $GLOBALS['TYPO3_DB']->exec_UPDATEquery()
$table | string | Database tablename |
$where | string | WHERE clause, eg. "uid=1" |
$fields_values | array | Field values as key=>value pairs. |
Returns: | string | Full SQL query for UPDATE |
@depreciated |
Returns
what is called the 'RootLine'. That is an array with information about
the page records from a page id ($uid) and back to the root.
By default deleted pages are filtered.
This RootLine will follow the tree all the way to the root. This is
opposite to another kind of root line known from the frontend where the
rootline stops when a root-template is found.
Usage: 13
$uid | integer | Page id for which to create the root line. |
$clause='' | string | $clause can be used to select other criteria. It would typically be where-clauses that stops the proces if we meet a page, the user has no reading access to. |
Returns: | array | Root line array, all the way to the page tree root (or as far as $clause allows!) |
Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage"
Each part of the path will be limited to $titleLimit characters
Deleted pages are filtered out.
Usage: 23
$uid | integer | Page uid for which to create record path |
$clause | string | $clause is additional where clauses, eg. " |
$titleLimit | integer | Title limit |
Returns: | string | Path of record |
Returns an array with the exclude-fields as defined in TCA
Used for listing the exclude-fields in be_groups forms
Usage: 2 (t3lib_tceforms + t3lib_transferdata)
Returns: | array | Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries |
Returns
a page record (of page with $id) with an extra field "_thePath" set to
the record path IF the WHERE clause, $perms_clause, selects the record.
If $id is zero a pseudo root-page with "_thePath" set is returned IF the current BE_USER is admin.
In any case ->isInWebMount must return true for the user (regardless of $perms_clause)
Usage: 21
$id | integer | Page uid for which to check read-access |
$perms_clause | string | $perms_clause is typically a value generated with $BE_USER->getPagePermsClause(1); |
Returns: | array | Returns page record if OK, otherwise false. |
Returns the "types" configuration parsed into an array for the record, $rec, from table, $table
Usage: 6
$table | string | Table name (present in TCA) |
$rec | array | Record from $table |
$useFieldNameAsKey=0 | boolean | If $useFieldNameAsKey is set, then the fieldname is associative keys in the return array, otherwise just numeric keys. |
Returns: | array |
Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $TCA
If no "type" field is configured in the "ctrl"-section of the $TCA for the table, zero is used.
If zero is not an index in the "types" section of $TCA for the table,
then the $fieldValue returned will default to 1 (no matter if that is
an index or not)
Usage: 7
$table | string | Table name present in TCA |
$rec | array | Record from $table |
Returns: | string | Field value |
@see getTCAtypes() |
Parses
a part of the field lists in the "types"-section of $TCA arrays, namely
the "special configuration" at index 3 (position 4)
Elements are splitted by ":" and within those parts, parameters are splitted by "|".
Everything is returned in an array and you should rather see it
visually than listen to me anymore now... Check out example in Inside
TYPO3
Usage: 3
$str | string | Content from the "types" configuration of TCA (the special configuration) - see description of function |
Returns: | array |
Takes an array of "[key]=[value]" strings and returns an array with the keys set as keys pointing to the value.
Better see it in action! Find example in Inside TYPO3
Usage: 6
$pArr | array | Array of "[key]=[value]" strings to convert. |
Returns: | array |
Finds the Data Structure for a FlexForm field
$conf | array | Field config array |
$row | array | Record data |
$table | string | The table name |
Returns: | mixed | If array, the data structure was found and returned as an array. Otherwise (string) it is an error message. |
@see t3lib_TCEforms::getSingleField_typeFlex() |
Stores the string value $data in the 'cache_hash' table with the hash key, $hash, and visual/symbolic identification, $ident
IDENTICAL to the function by same name found in t3lib_page:
Usage: 2
$hash | string | Hash key, 32 bytes hex |
$data | string | $data must be serialized before function call |
$ident | string | Visual/symbolic identification (informational only) |
Returns: | void |
Retrieves the string content stored with hash key, $hash, in cache_hash
IDENTICAL to the function by same name found in t3lib_page:
Usage: 2
$hash | string | Hash key, 32 bytes hex |
$expTime | integer | $expTime represents the expire time in seconds. For instance a value of 3600 would allow cached content within the last hour, otherwise nothing is returned. |
Returns: | string |
Returns the Page TSconfig for page with id, $id
Requires class "t3lib_TSparser"
Usage: 26 (spec. in ext info_pagetsconfig)
$id | integer | Page uid for which to create Page TSconfig |
$rootLine='' | array | If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated |
$returnPartArray=0 | boolean | If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser. |
Returns: | array | Page TSconfig |
@see t3lib_TSparser |
Updates Page TSconfig for a page with $id
The function seems to take $pageTS as an array with properties and
compare the values with those that already exists for the "object
string", $TSconfPrefix, for the page, then sets those values which were
not present.
$impParams can be supplied as already known Page TSconfig, otherwise it's calculated.
THIS DOES NOT CHECK ANY PERMISSIONS. SHOULD IT?
More documentation is needed.
Usage: 1 (ext. direct_mail)
$id | integer | Page id |
$pageTS | array | Page TS array to write |
$TSconfPrefix | string | Prefix for object paths |
$impParams='' | array | [Description needed.] |
Returns: | void | |
@internal | ||
@see implodeTSParams(), getPagesTSconfig() |
Implodes a multi dimensional TypoScript array, $p, into a one-dimentional array (return value)
Usage: 3
$p | array | TypoScript structure |
$k='' | string | Prefix string |
Returns: | array | Imploded TypoScript objectstring/values |
Returns an array with be_users records of all user NOT DELETED sorted by their username
Keys in the array is the be_users uid
Usage: 14 (spec. ext. "beuser" and module "web_perm")
$fields='username,usergroup,usergroup_cached_list,uid' | string | Optional $fields list (default: username,usergroup,usergroup_cached_list,uid) can be used to set the selected fields |
$where='' | string | Optional $where clause (fx. "AND username='pete'") can be used to limit query |
Returns: | array |
Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title
Usage: 8 (spec. ext. "beuser" and module "web_perm")
$fields='title,uid' | string | Field list |
$where='' | string | WHERE clause |
Returns: | array |
Returns an array with be_groups records (like ->getGroupNames) but:
- if the current BE_USER is admin, then all groups are returned,
otherwise only groups that the current user is member of
(usergroup_cached_list) will be returned.
Usage: 2 (module "web_perm" and ext. taskcenter)
$fields='title,uid' | string | Field list; $fields specify the fields selected (default: title,uid) |
Returns: | array |
Returns the array $usernames with the names of all users NOT IN $groupArray changed to the uid (hides the usernames!).
If $excludeBlindedFlag is set, then these records are unset from the array $usernames
Takes $usernames (array made by t3lib_BEfunc::getUserNames()) and a
$groupArray (array with the groups a certain user is member of) as input
Usage: 8
$usernames | array | User names |
$groupArray | array | Group names |
$excludeBlindedFlag=0 | boolean | If $excludeBlindedFlag is set, then these records are unset from the array $usernames |
Returns: | array | User names, blinded |
Corresponds to blindUserNames but works for groups instead
Usage: 2 (module web_perm)
$groups | array | Group names |
$groupArray | array | Group names (reference) |
$excludeBlindedFlag=0 | boolean | If $excludeBlindedFlag is set, then these records are unset from the array $usernames |
Returns: | array |
Returns the difference in days between input $tstamp and $EXEC_TIME
Usage: 2 (class t3lib_BEfunc)
$tstamp | integer | Time stamp, seconds |
Returns: | integer |
Returns $tstamp formatted as "ddmmyy" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy'])
Usage: 11
$tstamp | integer | Time stamp, seconds |
Returns: | string | Formatted time |
Returns $tstamp formatted as "ddmmyy hhmm" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy'] AND $TYPO3_CONF_VARS['SYS']['hhmm'])
Usage: 28
$value | integer | Time stamp, seconds |
Returns: | string | Formatted time |
Returns $value (in seconds) formatted as hh:mm:ss
For instance $value = 3600 + 60*2 + 3 should return "01:02:03"
Usage: 1 (class t3lib_BEfunc)
$value | integer | Time stamp, seconds |
Returns: | string | Formatted time |
Returns the "age" of the number of $seconds inputted.
Usage: 15
$seconds | integer | $seconds could be the difference of a certain timestamp and time() |
$labels | string | $labels should be something like ' min| hrs| days| yrs'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears") |
Returns: | string | Formatted time |
Returns a formatted timestamp if $tstamp is set.
The date/datetime will be followed by the age in parenthesis.
Usage: 3
$tstamp | integer | Time stamp, seconds |
$prefix=1 | integer | 1/-1 depending on polarity of age. |
$date='' | string | $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm" |
Returns: | string |
Returns
either title='' or alt='' attribute. This depends on the client browser
and whether it supports title='' or not (which is the default)
If no $content is given only the attribute name is returned.
The returned attribute with content will have a leading space char.
Warning: Be careful to submit empty $content var - that will return just the attribute name!
Usage: 203
$content='' | string | String to set as title-attribute. If no $content is given only the attribute name is returned. |
$hsc=0 | boolean | If $hsc is set, then content of the attribute is htmlspecialchar()'ed (which is good for XHTML and other reasons...) |
Returns: | string | |
@depreciated The idea made sense with older browsers, but now all browsers should support the "title" attribute - so just hardcode the title attribute instead! |
Returns alt="" and title="" attributes with the value of $content.
$content | string | Value for 'alt' and 'title' attributes (will be htmlspecialchars()'ed before output) |
Returns: | string |
Returns a linked image-tag for thumbnail(s) from a database row with a list of image files in a field
All $TYPO3_CONF_VARS['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example)
Thumbsnails are linked to the show_item.php script which will display further details.
Usage: 7
$row | array | $row is the database row from the table, $table. |
$table | string | Table name for $row (present in TCA) |
$field | string | $field is pointing to the field with the list of image files |
$backPath | string | Back path prefix for image tag src="" field |
$thumbScript='' | string | Optional: $thumbScript os by default 'thumbs.php' if you don't set it otherwise |
$uploaddir='' | string | Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $TCA for that field! so you don't have to!) |
$abs=0 | boolean | If set, uploaddir is NOT prepended with "../" |
$tparams='' | string | Optional: $tparams is additional attributes for the image tags |
$size='' | integer | Optional: $size is [w]x[h] of the thumbnail. 56 is default. |
Returns: | string | Thumbnail image tag. |
Returns single image tag to thumbnail
Usage: 3
$thumbScript | string | $thumbScript must point to "thumbs.php" relative to the script position |
$theFile | string | $theFile must be the proper reference to the file thumbs.php should show |
$tparams='' | string | $tparams are additional attributes for the image tag |
$size='' | integer | $size is the size of the thumbnail send along to "thumbs.php" |
Returns: | string | Image tag |
Returns
title-attribute information for a page-record informing about id,
alias, doktype, hidden, starttime, endtime, fe_group etc.
Usage: 8
$row | array | Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table) |
$perms_clause='' | string | $perms_clause is used to get the record path of the shortcut page, if any (and doktype==4) |
$includeAttrib=1 | boolean | If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already |
Returns: | string |
Returns title-attribute information for ANY record (from a table defined in TCA of course)
The included information depends on features of the table, but if
hidden, starttime, endtime and fe_group fields are configured for,
information about the record status in regard to these features are is
included.
"pages" table can be used as well and will return the result of ->titleAttribForPages() for that page.
Usage: 10
$row | array | Table row; $row is a row from the table, $table |
$table='pages' | string | Table name |
Returns: | string |
Returns
the label of the first found entry in an "items" array from $TCA
(tablename=$table/fieldname=$col) where the value is $key
Usage: 9
$table | string | Table name, present in $TCA |
$col | string | Field name, present in $TCA |
$key | string | items-array value to match |
Returns: | string | Label for item entry |
Returns the label-value for fieldname $col in table, $table
If $printAllWrap is set (to a "wrap") then it's wrapped around the $col
value IF THE COLUMN $col DID NOT EXIST in TCA!, eg.
$printAllWrap='<b>|</b>' and the fieldname was
'not_found_field' then the return value would be
'<b>not_found_field</b>'
Usage: 17
$table | string | Table name, present in $TCA |
$col | string | Field name |
$printAllWrap='' | string | Wrap value - set function description |
Returns: | string |
Returns the "title"-value in record, $row, from table, $table
The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force'
Usage: 26
$table | string | Table name, present in TCA |
$row | array | Row from table |
$prep=0 | boolean | If set, result is prepared for output: The output is cropped to a limited lenght (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed |
Returns: | string |
Returns a human readable output of a value from a record
For instance a database record relation would be looked up to display
the title-value of that record. A checkbox with a "1" value would be
"Yes", etc.
$table/$col is tablename and fieldname
REMEMBER to pass the output through htmlspecialchars() if you output it
to the browser! (To protect it from XSS attacks and be XHTML compliant)
Usage: 24
$table | string | Table name, present in TCA |
$col | string | Field name, present in TCA |
$value | string | $value is the value of that field from a selected record |
$fixed_lgd_chars=0 | integer | $fixed_lgd_chars is the max amount of characters the value may occupy |
$defaultPassthrough=0 | boolean | $defaultPassthrough flag means that values for columns that has no conversion will just be pass through directly (otherwise cropped to 200 chars or returned as "N/A") |
Returns: | string |
Same
as ->getProcessedValue() but will go easy on fields like "tstamp"
and "pid" which are not configured in TCA - they will be formatted by
this function instead.
Usage: 2
$table | string | Table name, present in TCA |
$fN | string | Field name |
$fV | string | Field value |
$fixed_lgd_chars=0 | integer | $fixed_lgd_chars is the max amount of characters the value may occupy |
Returns: | string | |
@see getProcessedValue() |
Returns file icon name (from $FILEICONS) for the fileextension $ext
Usage: 10
$ext | string | File extension, lowercase |
Returns: | string | File icon filename |
Returns fields for a table, $table, which would typically be interesting to select
This includes uid, the fields defined for title, icon-field.
Returned as a list ready for query ($prefix can be set to eg. "pages."
if you are selecting from the pages table and want the table name
prefixed)
Usage: 3
$table | string | Table name, present in TCA |
$prefix | string | Table prefix |
Returns: | string | List of fields. |
Makes
a form for configuration of some values based on configuration found in
the array $configArray, with default values from $defaults and a
data-prefix $dataPrefix
<form>-tags must be supplied separately
Needs more documentation and examples, in particular syntax for
configuration array. See Inside TYPO3. That's were you can expect to
find example, if anywhere.
Usage: 1 (ext. direct_mail)
$configArray | array | Field configuration code. |
$defaults | array | Defaults |
$dataPrefix | string | Prefix for formfields |
Returns: | string | HTML for a form. |
Returns help-text icon if configured for.
TCA_DESCR must be loaded prior to this function and $BE_USER must have
'edit_showFieldHelp' set to 'icon', otherwise nothing is returned
Usage: 6
$table | string | Table name |
$field | string | Field name |
$BACK_PATH | string | Back path |
$force=0 | boolean | Force display of icon nomatter BE_USER setting for help |
Returns: | string | HTML content for a help icon/text |
Returns CSH help text (description), if configured for.
TCA_DESCR must be loaded prior to this function and $BE_USER must have
"edit_showFieldHelp" set to "text", otherwise nothing is returned
Will automatically call t3lib_BEfunc::helpTextIcon() to get the icon for the text.
Usage: 10
$table | string | Table name |
$field | string | Field name |
$BACK_PATH | string | Back path |
Returns: | string | HTML content for help text |
Returns
a JavaScript string (for an onClick handler) which will load the
alt_doc.php script that shows the form for editing of the record(s) you
have send as params.
REMEMBER to always htmlspecialchar() content in href-properties to
ampersands get converted to entities (XHTML requirement and XSS
precaution)
Usage: 35
$params | string | $params is parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123]=edit' which will show edit form for page record 123. |
$backPath='' | string | $backPath must point back to the TYPO3_mainDir directory (where alt_doc.php is) |
$requestUri='' | string | $requestUri is an optional returnUrl you can set - automatically set to REQUEST_URI. |
Returns: | string |
Returns a JavaScript string for viewing the page id, $id
Usage: 8
$id | integer | $id is page id |
$backPath='' | string | $backpath must point back to TYPO3_mainDir (where the site is assumed to be one level above) |
$rootLine='' | array | If root line is supplied the function will look for the first found domain record and use that URL instead (if found) |
$anchor='' | string | $anchor is optional anchor to the URL |
$altUrl='' | string | $altUrl is an alternative URL which - if set - will make all other parameters ignored: The function will just return the window.open command wrapped around this URL! |
Returns: | string |
Returns the merged User/Page TSconfig for page id, $id.
Please read details about module programming elsewhere!
Usage: 15
$id | integer | Page uid |
$TSref | string | $TSref is an object string which determines the path of the TSconfig to return. |
Returns: | array |
Returns a selector box "function menu" for a module
Requires the JS function jumpToUrl() to be available
See Inside TYPO3 for details about how to use / make Function menus
Usage: 50
$id | string | $id is the "&id=" parameter value to be sent to the module |
$elementName | string | $elementName it the form elements name, probably something like "SET[...]" |
$currentValue | string | $currentValue is the value to be selected currently. |
$menuItems | array | $menuItems is an array with the menu items for the selector box |
$script='' | string | $script is the script to send the &id to, if empty it's automatically found |
$addparams='' | string | $addParams is additional parameters to pass to the script. |
Returns: | string | HTML code for selector box |
Checkbox function menu.
Works like ->getFuncMenu() but takes no $menuItem array since this is a simple checkbox.
Usage: 34
$id | string | $id is the "&id=" parameter value to be sent to the module |
$elementName | string | $elementName it the form elements name, probably something like "SET[...]" |
$currentValue | string | $currentValue is the value to be selected currently. |
$script='' | string | $script is the script to send the &id to, if empty it's automatically found |
$addparams='' | string | $addParams is additional parameters to pass to the script. |
$tagParams='' | string | Additional attributes for the checkbox input tag |
Returns: | string | HTML code for checkbox |
@see getFuncMenu() |
Input field function menu
Works like ->getFuncMenu() / ->getFuncCheck() but displays a input field instead which updates the script "onchange"
Usage: 1
$id | string | $id is the "&id=" parameter value to be sent to the module |
$elementName | string | $elementName it the form elements name, probably something like "SET[...]" |
$currentValue | string | $currentValue is the value to be selected currently. |
$size=10 | integer | Relative size of input field, max is 48 |
$script="" | string | $script is the script to send the &id to, if empty it's automatically found |
$addparams="" | string | $addParams is additional parameters to pass to the script. |
Returns: | string | HTML code for input text field. |
@see getFuncMenu() |
Removes menu items from $itemArray if they are configured to be removed by TSconfig for the module ($modTSconfig)
See Inside TYPO3 about how to program modules and use this API.
Usage: 4
$modTSconfig | array | Module TS config array |
$itemArray | array | Array of items from which to remove items. |
$TSref | string | $TSref points to the "object string" in $modTSconfig |
Returns: | array | The modified $itemArray is returned. |
Call to update the page tree frame (or something else..?) after
t3lib_BEfunc::getSetUpdateSignal('updatePageTree') -> will set the page tree to be updated.
t3lib_BEfunc::getSetUpdateSignal() -> will return some JavaScript
that does the update (called in the typo3/template.php file, end()
function)
Usage: 11
$set='' | string | Whether to set or clear the update signal. When setting, this value contains strings telling WHAT to set. At this point it seems that the value "updatePageTree" is the only one it makes sense to set. |
Returns: | string | HTML code (<script> section) |
Returns
an array which is most backend modules becomes MOD_SETTINGS containing
values from function menus etc. determining the function of the module.
This is kind of session variable management framework for the backend users.
If a key from MOD_MENU is set in the CHANGED_SETTINGS array (eg. a
value is passed to the script from the outside), this value is put into
the settings-array
Ultimately, see Inside TYPO3 for how to use this function in relation to your modules.
Usage: 23
$MOD_MENU | array | MOD_MENU is an array that defines the options in menus. |
$CHANGED_SETTINGS | array | CHANGED_SETTINGS represents the array used when passing values to the script from the menus. |
$modName | string | modName is the name of this module. Used to get the correct module data. |
$type='' | string | If type is 'ses' then the data is stored as session-lasting data. This means that it'll be wiped out the next time the user logs in. |
$dontValidateList='' | string | dontValidateList can be used to list variables that should not be checked if their value is found in the MOD_MENU array. Used for dynamically generated menus. |
$setDefaultList='' | string | List of default values from $MOD_MENU to set in the output array (only if the values from MOD_MENU are not arrays) |
Returns: | array | The array $settings, which holds a key for each MOD_MENU key and the values of each key will be within the range of values for each menuitem |
Unlock or Lock a record from $table with $uid
If $table and $uid is not set, then all locking for the current BE_USER is removed!
Usage: 5
$table='' | string | Table name |
$uid=0 | integer | Record uid |
$pid=0 | integer | Record pid |
Returns: | void | |
@internal | ||
@see t3lib_transferData::lockRecord(), alt_doc.php, db_layout.php, db_list.php, wizard_rte.php |
Returns
information about whether the record from table, $table, with uid, $uid
is currently locked (edited by another user - which should issue a
warning).
Notice: Locking is not strictly carried out since locking is abandoned
when other backend scripts are activated - which means that a user CAN
have a record "open" without having it locked. So this just serves as a
warning that counts well in 90% of the cases, which should be
sufficient.
Usage: 5
$table | string | Table name |
$uid | integer | Record uid |
Returns: | array | |
@internal | ||
@see class.db_layout.inc, alt_db_navframe.php, alt_doc.php, db_layout.php |
Returns select statement for MM relations (as used by TCEFORMs etc)
Usage: 3
$fieldValue | array | Configuration array for the field, taken from $TCA |
$field='' | string | Field name |
$TSconfig=array() | array | TSconfig array from which to get further configuration settings for the field name |
$prefix='' | string | Prefix string for the key "*foreign_table_where" from $fieldValue array |
Returns: | string | Part of query |
@internal | ||
@see t3lib_transferData::renderRecord(), t3lib_TCEforms::foreignTable() |
Returns TSConfig for the TCEFORM object in Page TSconfig.
Used in TCEFORMs
Usage: 4
$table | string | Table name present in TCA |
$row | array | Row from table |
Returns: | array | |
@see t3lib_transferData::renderRecord(), t3lib_TCEforms::setTSconfig(), SC_wizard_list::main(), SC_wizard_add::main() |
Find
the real PID of the record (with $uid from $table). This MAY be
impossible if the pid is set as a reference to the former record or a
page (if two records are created at one time).
Usage: 2
$table | string | Table name |
$uid | integer | Record uid |
$pid | integer | Record pid |
Returns: | integer | |
@internal | ||
@see t3lib_TCEmain::copyRecord(), getTSCpid() |
Return $uid if $table is pages and $uid is integer - otherwise the $pid
Usage: 1
$table | string | Table name |
$uid | integer | Record uid |
$pid | integer | Record pid |
Returns: | integer | |
@internal | ||
@see t3lib_TCEforms::getTSCpid() |
Returns
the REAL pid of the record, if possible. If both $uid and $pid is
strings, then pid=-1 is returned as an error indication.
Usage: 8
$table | string | Table name |
$uid | integer | Record uid |
$pid | integer | Record pid |
Returns: | integer | |
@internal | ||
@see t3lib_TCEmain::setHistory(), t3lib_TCEmain::process_datamap() |
Returns first found domain record "domainName" (without trailing slash) if found in the input $rootLine
Usage: 2
$rootLine | array | Root line array |
Returns: | string | Domain name, if found. |
Returns the sys_domain record for $domain, optionally with $path appended.
Usage: 2
$domain | string | Domain name |
$path='' | string | Appended path |
Returns: | array | Domain record, if found |
Returns overlayered RTE setup from an array with TSconfig. Used in TCEforms and TCEmain
Usage: 8
$RTEprop | array | The properties of Page TSconfig in the key "RTE." |
$table | string | Table name |
$field | string | Field name |
$type='' | string | Type value of the current record (like from CType of tt_content) |
Returns: | array | Array with the configuration for the RTE |
@internal |
Returns true if $modName is set and is found as a main- or submodule in $TBE_MODULES array
Usage: 1
$modName | string | Module name |
Returns: | boolean |
Print error message with header, text etc.
Usage: 19
$header | string | Header string |
$text | string | Content string |
$js='' | boolean | Will return an alert() with the content of header and text. |
$head=1 | boolean | Print header. |
Returns: | void |
Returns "web" if the $path (absolute) is within the DOCUMENT ROOT - and thereby qualifies as a "web" folder.
Usage: 4
$path | string | Path to evaluate |
Returns: | boolean |
Creates ADMCMD parameters for the "viewpage" extension / "cms" frontend
Usage: 1
$pageinfo | array | Page record |
Returns: | string | Query-parameters |
@internal |
Returns an array with key=>values based on input text $params
$params is exploded by line-breaks and each line is supposed to be on the syntax [key] = [some value]
These pairs will be parsed into an array an returned.
Usage: 1
$params | string | String of parameters on multiple lines to parse into key-value pairs (see function description) |
Returns: | array |
Returns "list of backend modules". Most likely this will be obsolete soon / removed. Don't use.
Usage: 3
$name | array | Module names in array. Must be "addslashes()"ed |
$perms_clause | string | Perms clause for SQL query |
$backPath='' | string | Backpath |
$script='index.php' | string | The URL/script to jump to (used in A tag) |
Returns: | array | Two keys, rows and list |
@internal | ||
@depreciated | ||
@obsolete |
TYPO3 user authentication, backend
Could technically have been the same class as t3lib_userauthgroup since these two are always used together and only together.
t3lib_userauthgroup contains most of the functions used for checking
permissions, authenticating users, setting up the user etc. This class
is most interesting in terms of an API for user from outside.
This class contains the configuration of the database fields used plus
some functions for the authentication process of backend users.
Filesize: | 12.6 K |
Func/Classes: | 9 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
TYPO3 user authentication, backend
Could technically have been the same class as t3lib_userauthgroup since these two are always used together and only together.
t3lib_userauthgroup contains most of the functions used for checking
permissions, authenticating users, setting up the user etc. This class
is most interesting in terms of an API for user from outside.
This class contains the configuration of the database fields used plus
some functions for the authentication process of backend users.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
If
flag is set and the extensions 'beuser_tracking' is loaded, this will
insert a table row with the REQUEST_URI of current script - thus
tracking the scripts the backend users uses...
This function works ONLY with the "beuser_tracking" extension and is depreciated since it does nothing useful.
$flag | boolean | Activate insertion of the URL. |
Returns: | void |
If TYPO3_CONF_VARS['BE']['enabledBeUserIPLock'] is enabled and an IP-list is found in the User TSconfig objString "options.lockToIP", then make an IP comparison with REMOTE_ADDR and return the outcome (true/false)
Returns: | boolean | True, if IP address validates OK (or no check is done at all) |
Check
if user is logged in and if so, call ->fetchGroupData() to load
group information and access lists of all kind, further check IP, set
the ->uc array and send login-notification email if required.
If no user is logged in the default behaviour is to exit with an error
message, but this will happen ONLY if the constant
TYPO3_PROCEED_IF_NO_USER is set true.
This function is called right after ->start() in fx. init.php
Returns: | void |
Initialize the internal ->uc array for the backend user
Will make the overrides if necessary, and write the UC back to the be_users record if changes has happend
Returns: | void | |
@internal |
Override: Call this function every time the uc is updated.
That is 1) by reverting to default values, 2) in the setup-module, 3) userTS changes (userauthgroup)
Returns: | void | |
@internal |
Clears the user[uc] and ->uc to blank strings. Then calls ->backendSetUC() to fill it again with reset contents
Returns: | void | |
@internal |
Will send an email notification to warning_email_address/the login users email address when a login session is just started.
Depends on various parameters whether mails are send and to whom.
Returns: | void |
VeriCode returns 10 first chars of a md5 hash of the session cookie AND the encryptionKey from TYPO3_CONF_VARS.
This code is used as an alternative verification when the JavaScript
interface executes cmd's to tce_db.php from eg. MSIE 5.0 because the
proper referer is not passed with this browser...
Returns: | string |
Extension class for the t3lib_treeView class, specially made for browsing pages
Filesize: | 4.3 K |
Func/Classes: | 4 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @coauthor René Fritz <r.fritz@colorcube.de> @see t3lib_treeView, t3lib_pageTree @package TYPO3 @subpackage t3lib |
Extension class for the t3lib_treeView class, specially made for browsing pages
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@coauthor René Fritz <r.fritz@colorcube.de> | ||
@see t3lib_treeView, t3lib_pageTree | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialize, setting what is necessary for browsing pages.
Using the current user.
$clause='' | string | Additional clause for selecting pages. |
Returns: | void |
Creates title attribute content for pages.
Uses API function in t3lib_BEfunc which will retrieve lots of useful information for pages.
$row | array | The table row. |
Returns: | string |
Wrapping the image tag, $icon, for the row, $row (except for mount points)
$icon | string | The image tag for the icon |
$row | array | The row for the current element |
Returns: | string | The processed icon input value. |
TYPO3 clipboard for records and files
Filesize: | 32 K |
Func/Classes: | 31 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
TYPO3 clipboard for records and files
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Call
this method after initialization if you want to lock the clipboard to
operate on the normal pad only. Trying to switch pad through
->setCmd will not work
This is used by the clickmenu since it only allows operation on single elements at a time (that is the "normal" pad)
Returns: | void |
The array $cmd may hold various keys which notes some action to take.
Normally perform only one action at a time.
In scripts like db_list.php / file_list.php the GET-var CB is used to control the clipboard.
Selecting / Deselecting elements
Array $cmd['el'] has keys = element-ident, value = element value (see description of clipData array in header)
Selecting elements for 'copy' should be done by simultaneously setting setCopyMode.
$cmd | array | Array of actions, see function description |
Returns: | void |
Setting the current pad on clipboard
$padIdent | string | Key in the array $this->clipData |
Returns: | void |
Call this after initialization and setCmd in order to save the clipboard to the user session.
The function will check if the internal flag ->changed has been set and if so, save the clipboard. Else not.
Returns: | void |
Cleans up an incoming element array $CBarr (Array selecting/deselecting elements)
$CBarr | array | Element array from outside ("key" => "selected/deselected") |
$table | string | $table is the 'table which is allowed'. Must be set. |
$removeDeselected=0 | boolean | $removeDeselected can be set in order to remove entries which are marked for deselection. |
Returns: | array | Processed input $CBarr |
Reports if the current pad has elements (does not check file/DB type OR if file/DBrecord exists or not. Only counting array)
Returns: | boolean | True if elements exist. |
Print the content on a pad. Called from ->printClipboard()
$pad | string | Pad reference |
Returns: | array | Array with table rows for the clipboard. |
Wraps title of pad in bold-tags and maybe the number of elements if any.
$str | string | String (already htmlspecialchars()'ed) |
$pad | string | Pad reference |
Returns: | string | HTML output (htmlspecialchar'ed content inside of tags.) |
Wraps the title of the items listed in link-tags. The items will link to the page/folder where they originate from
$str | string | Title of element - must be htmlspecialchar'ed on beforehand. |
$rec | mixed | If array, a record is expected. If string, its a path |
$table='' | string | Table name |
Returns: | string |
Verifies if the item $table/$uid is on the current pad.
If the pad is "normal", the mode value is returned if the element existed. Thus you'll know if the item was copy or cut moded...
$table | string | Table name, (_FILE for files...) |
$uid | integer | Element uid (path for files) |
Returns: | string |
Returns item record $table,$uid if selected on current clipboard
If table and uid is blank, the first element is returned.
Makes sense only for DB records - not files!
$table='' | string | Table name |
$uid='' | integer | Element uid |
Returns: | array | Element record with extra field _RECORD_TITLE set to the title of the record... |
Returns the select-url for database elements
$table | string | Table name |
$uid | integer | Uid of record |
$copy=0 | boolean | If set, copymode will be enabled |
$deselect=0 | boolean | If set, the link will deselect, otherwise select. |
$baseArray=array() | array | The base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included. |
Returns: | string | URL linking to the current script but with the CB array set to select the element with table/uid |
Returns the select-url for files
$path | string | Filepath |
$copy=0 | boolean | If set, copymode will be enabled |
$deselect=0 | boolean | If set, the link will deselect, otherwise select. |
$baseArray=array() | array | The base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included. |
Returns: | string | URL linking to the current script but with the CB array set to select the path |
pasteUrl of the element (database and file)
For the meaning of $table and $uid, please read from ->makePasteCmdArray!!!
The URL will point to tce_file or tce_db depending in $table
$table | string | Tablename (_FILE for files) |
$uid | mixed | "destination": can be positive or negative indicating how the paste is done (paste into / paste after) |
$setRedirect=1 | boolean | If set, then the redirect URL will point back to the current script, but with CB reset. |
Returns: | string |
deleteUrl for current pad
$setRedirect=1 | boolean | If set, then the redirect URL will point back to the current script, but with CB reset. |
$file=0 | boolean | If set, then the URL will link to the tce_file.php script in the typo3/ dir. |
Returns: | string |
editUrl of all current elements
ONLY database
Links to alt_doc.php
Returns: | string | The URL to alt_doc.php with parameters. |
Returns the remove-url (file and db)
for file $table='_FILE' and $uid = shortmd5 hash of path
$table | string | Tablename |
$uid | string | uid integer/shortmd5 hash |
Returns: | string | URL |
This traverses the elements on the current clipboard pane
and unsets elements which does not exist anymore or are disabled.
Returns: | void |
Counts the number of elements from the table $matchTable. If $matchTable is blank, all tables (except '_FILE' of course) is counted.
$matchTable='' | string | Table to match/count for. |
$pad='' | string | $pad can optionally be used to set another pad than the current. |
Returns: | array | Array with keys from the CB. |
Returns confirm JavaScript message
$table | string | Table name |
$rec | mixed | For records its an array, for files its a string (path) |
$type | string | Type-code |
$clElements | array | Array of selected elements |
Returns: | string | JavaScript "confirm" message |
Removes element on clipboard
$el | string | Key of element in ->clipData array |
Returns: | void |
Saves the clipboard, no questions asked.
Use ->endClipboard normally (as it checks if changes has been done so saving is necessary)
Returns: | void |
Clipboard label - getting from "EXT:lang/locallang_core.php:"
$key | string | Label Key |
$Akey='labels' | string | Alternative key to "labels" |
Returns: | string |
Applies the proper paste configuration in the $cmd array send to tce_db.php.
$ref is the target, see description below.
The current pad is pasted
$ref: [tablename]:[paste-uid].
tablename is the name of the table from which elements *on the current clipboard* is pasted with the 'pid' paste-uid.
No tablename means that all items on the clipboard (non-files) are pasted. This requires paste-uid to be positive though.
so 'tt_content:-3' means 'paste tt_content elements on the clipboard to AFTER tt_content:3 record
'tt_content:30' means 'paste tt_content elements on the clipboard into page with id 30
':30' means 'paste ALL database elements on the clipboard into page with id 30
':-30' not valid.
$ref | string | [tablename]:[paste-uid], see description |
$CMD | array | Command-array |
Returns: | array | Modified Command-array |
Delete record entries in CMD array
$CMD | array | Command-array |
Returns: | array | Modified Command-array |
Applies the proper paste configuration in the $file array send to tce_file.php.
The current pad is pasted
$ref | string | Reference to element (splitted by "|") |
$FILE | array | Command-array |
Returns: | array | Modified Command-array |
Delete files in CMD array
$FILE | array | Command-array |
Returns: | array | Modified Command-array |
Class for conversion between charsets.
Filesize: | 25 K |
Func/Classes: | 16 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @author Martin Kutschker <martin.t.kutschker@blackbox.net> @package TYPO3 @subpackage t3lib |
Class for conversion between charsets.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@author Martin Kutschker <martin.t.kutschker@blackbox.net> | ||
@package TYPO3 | ||
@subpackage t3lib |
Normalize - changes input character set to lowercase letters.
$charset | string | Input charset |
Returns: | string | Normalized charset |
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
Convert from one charset to another charset.
$str | string | Input string |
$fromCS | string | From charset (the current charset of the string) |
$toCS | string | To charset (the output charset wanted) |
$useEntityForNoChar=0 | boolean | If set, then characters that are not available in the destination character set will be encoded as numeric entities |
Returns: | string | Converted string |
Converts $str from $charset to UTF-8
$str | string | String in local charset to convert to UTF-8 |
$charset | string | Charset, lowercase. Must be found in csconvtbl/ folder. |
Returns: | string | Output string, converted to UTF-8 |
Converts $str from UTF-8 to $charset
$str | string | String in UTF-8 to convert to local charset |
$charset | string | Charset, lowercase. Must be found in csconvtbl/ folder. |
$useEntityForNoChar=0 | boolean | If set, then characters that are not available in the destination character set will be encoded as numeric entities |
Returns: | string | Output string, converted to local charset |
Converts all chars > 127 to numeric entities.
$str | string | Input string |
Returns: | string | Output string |
Converts numeric entities (UNICODE, eg. decimal (Ӓ) or hexadecimal ()) to UTF-8 multibyte chars
$str | string | Input string, UTF-8 |
$alsoStdHtmlEnt=0 | boolean | If set, then all string-HTML entities (like & or £ will be converted as well) |
Returns: | string | Output string |
Converts all chars in the input UTF-8 string into integer numbers returned in an array
$str | string | Input string, UTF-8 |
$convEntities=0 | boolean | If set, then all HTML entities (like & or £ or { or 㽝) will be detected as characters. |
$retChar=0 | boolean | If set, then instead of integer numbers the real UTF-8 char is returned. |
Returns: | array | Output array with the char numbers |
This will initialize a charset for use if it's defined in the PATH_t3lib.'csconvtbl/' folder
This function is automatically called by the conversion functions
PLEASE SEE: http://www.unicode.org/Public/MAPPINGS/
$charset | string | The charset to be initialized. Use lowercase charset always (the charset must match exactly with a filename in csconvtbl/ folder ([charset].tbl) |
Returns: | integer | Returns '1' if already loaded. Returns FALSE if charset conversion table was not found. Returns '2' if the charset conversion table was found and parsed. |
Converts a UNICODE number to a UTF-8 multibyte character
Algorithm based on script found at From: http://czyborra.com/utf/
The binary representation of the character's integer value is thus
simply spread across the bytes and the number of high bits set in the
lead byte announces the number of bytes in the multibyte sequence:
bytes | bits | representation
1 | 7 | 0vvvvvvv
2 | 11 | 110vvvvv 10vvvvvv
3 | 16 | 1110vvvv 10vvvvvv 10vvvvvv
4 | 21 | 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv
5 | 26 | 111110vv 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv
6 | 31 | 1111110v 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv
$cbyte | integer | UNICODE integer |
Returns: | string | UTF-8 multibyte character string |
@see utf8CharToUnumber() |
Converts a UTF-8 Multibyte character to a UNICODE number
$str | string | UTF-8 multibyte character string |
$hex=0 | boolean | If set, then a hex. number is returned. |
Returns: | integer | UNICODE integer |
@see UnumberToChar() |
Truncates a string in UTF-8 short at a given byte length
$str | string | UTF-8 multibyte character string |
$len | integer | the byte length |
Returns: | string | the shortened string |
@see strcut() | ||
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
$str | [type] | $str: ... |
Returns: | [type] | ... |
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
$str | [type] | $str: ... |
$start | [type] | $start: ... |
$len=0 | [type] | $len: ... |
Returns: | [type] | ... |
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
$haystack | [type] | $haystack: ... |
$needle | [type] | $needle: ... |
$offset=0 | [type] | $offset: ... |
Returns: | [type] | ... |
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
$haystack | [type] | $haystack: ... |
$needle | [type] | $needle: ... |
$offset=0 | [type] | $offset: ... |
Returns: | [type] | ... |
@author Martin Kutschker <martin.t.kutschker@blackbox.net> |
TYPO3 "database wrapper" class (new in 3.6.0)
This class contains
- abstraction functions for executing INSERT/UPDATE/DELETE/SELECT
queries ("Query execution"; These are REQUIRED for all future
connectivity to the database, thus ensuring DBAL compliance!)
- functions for building SQL queries (INSERT/UPDATE/DELETE/SELECT)
("Query building"); These are transitional functions for building SQL
queries in a more automated way. Use these to build queries instead of
doing it manually in your code!
- mysql() wrapper functions; These are transitional functions. By a
simple search/replace you should be able to substitute all mysql*()
calls with $GLOBALS['TYPO3_DB']->sql*() and your application will
work out of the box. YOU CANNOT (legally) use any mysql functions not
found as wrapper functions in this class!
See the Project Coding Guidelines (doc_core_cgl) for more instructions on best-practise
This class is not in itself a complete database abstraction layer but
can be extended to be a DBAL (by extensions, see "dbal" for example)
ALL connectivity to the database in TYPO3 must be done through this class!
The points of this class are:
- To direct all database calls through this class so it becomes possible to implement DBAL with extensions.
- To keep it very easy to use for developers used to MySQL in PHP - and
preserve as much performance as possible when TYPO3 is used with MySQL
directly...
- To create an interface for DBAL implemented by extensions; (Eg.
making possible escaping characters, clob/blob handling, reserved words
handling)
- Benchmarking the DB bottleneck queries will become much easier; Will make it easier to find optimization possibilities.
USE:
In all TYPO3 scripts the global variable $TYPO3_DB is an instance of this class. Use that.
Eg. $GLOBALS['TYPO3_DB']->sql_fetch_assoc()
Filesize: | 31 K |
Func/Classes: | 38 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
TYPO3 "database wrapper" class (new in 3.6.0)
This class contains
- abstraction functions for executing INSERT/UPDATE/DELETE/SELECT
queries ("Query execution"; These are REQUIRED for all future
connectivity to the database, thus ensuring DBAL compliance!)
- functions for building SQL queries (INSERT/UPDATE/DELETE/SELECT)
("Query building"); These are transitional functions for building SQL
queries in a more automated way. Use these to build queries instead of
doing it manually in your code!
- mysql() wrapper functions; These are transitional functions. By a
simple search/replace you should be able to substitute all mysql*()
calls with $GLOBALS['TYPO3_DB']->sql*() and your application will
work out of the box. YOU CANNOT (legally) use any mysql functions not
found as wrapper functions in this class!
See the Project Coding Guidelines (doc_core_cgl) for more instructions on best-practise
This class is not in itself a complete database abstraction layer but
can be extended to be a DBAL (by extensions, see "dbal" for example)
ALL connectivity to the database in TYPO3 must be done through this class!
The points of this class are:
- To direct all database calls through this class so it becomes possible to implement DBAL with extensions.
- To keep it very easy to use for developers used to MySQL in PHP - and
preserve as much performance as possible when TYPO3 is used with MySQL
directly...
- To create an interface for DBAL implemented by extensions; (Eg.
making possible escaping characters, clob/blob handling, reserved words
handling)
- Benchmarking the DB bottleneck queries will become much easier; Will make it easier to find optimization possibilities.
USE:
In all TYPO3 scripts the global variable $TYPO3_DB is an instance of this class. Use that.
Eg. $GLOBALS['TYPO3_DB']->sql_fetch_assoc()
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
Using this function specifically allows us to handle BLOB and CLOB fields depending on DB
Usage count/core: 47
$table | string | Table name |
$fields_values | array | Field values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$insertFields" with 'fieldname'=>'value' and pass it to this function as argument. |
Returns: | pointer | MySQL result pointer / DBAL object |
Creates
and executes an UPDATE SQL-statement for $table where $where-clause
(typ. 'uid=...') from the array with field/value pairs $fields_values.
Using this function specifically allow us to handle BLOB and CLOB fields depending on DB
Usage count/core: 50
$table | string | Database tablename |
$where | string | WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->quoteStr() yourself! |
$fields_values | array | Field values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$updateFields" with 'fieldname'=>'value' and pass it to this function as argument. |
Returns: | pointer | MySQL result pointer / DBAL object |
Creates and executes a DELETE SQL-statement for $table where $where-clause
Usage count/core: 40
$table | string | Database tablename |
$where | string | WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->quoteStr() yourself! |
Returns: | pointer | MySQL result pointer / DBAL object |
Creates and executes a SELECT SQL-statement
Using this function specifically allow us to handle the LIMIT feature independently of DB.
Usage count/core: 340
$select_fields | string | List of fields to select from the table. This is what comes right after "SELECT ...". Required value. |
$from_table | string | Table(s) from which to select. This is what comes right after "FROM ...". Required value. |
$where_clause | string | Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->quoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy='' | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy='' | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit='' | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | pointer | MySQL result pointer / DBAL object |
Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined
$local_table and $mm_table is mandatory. $foreign_table is optional.
The JOIN is done with [$local_table].uid <-->
[$mm_table].uid_local / [$mm_table].uid_foreign <-->
[$foreign_table].uid
The function is very useful for selecting MM-relations between tables
adhering to the MM-format used by TCE (TYPO3 Core Engine). See the
section on $TCA in Inside TYPO3 for more details.
Usage: 12 (spec. ext. sys_action, sys_messages, sys_todos)
$select | string | Field list for SELECT |
$local_table | string | Tablename, local table |
$mm_table | string | Tablename, relation table |
$foreign_table | string | Tablename, foreign table |
$whereClause='' | string | Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->quoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy='' | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy='' | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit='' | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | pointer | MySQL result pointer / DBAL object |
@see exec_SELECTquery() |
Executes a select based on input query parts array
Usage: 9
$queryParts | array | Query parts array |
Returns: | pointer | MySQL select result pointer / DBAL object |
@see exec_SELECTquery() |
Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
Usage count/core: 4
$table | string | See exec_INSERTquery() |
$fields_values | array | See exec_INSERTquery() |
Returns: | string | Full SQL query for INSERT (unless $fields_values does not contain any elements in which case it will be false) |
@depreciated use exec_INSERTquery() instead if possible! |
Creates
an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...')
from the array with field/value pairs $fields_values.
Usage count/core: 6
$table | string | See exec_UPDATEquery() |
$where | string | See exec_UPDATEquery() |
$fields_values | array | See exec_UPDATEquery() |
Returns: | string | Full SQL query for UPDATE (unless $fields_values does not contain any elements in which case it will be false) |
@depreciated use exec_UPDATEquery() instead if possible! |
Creates a DELETE SQL-statement for $table where $where-clause
Usage count/core: 3
$table | string | See exec_DELETEquery() |
$where | string | See exec_DELETEquery() |
Returns: | string | Full SQL query for DELETE |
@depreciated use exec_DELETEquery() instead if possible! |
Creates a SELECT SQL-statement
Usage count/core: 11
$select_fields | string | See exec_SELECTquery() |
$from_table | string | See exec_SELECTquery() |
$where_clause | string | See exec_SELECTquery() |
$groupBy='' | string | See exec_SELECTquery() |
$orderBy='' | string | See exec_SELECTquery() |
$limit='' | string | See exec_SELECTquery() |
Returns: | string | Full SQL query for SELECT |
@depreciated use exec_SELECTquery() instead if possible! |
Returns a WHERE clause that can find a value ($value) in a list field ($field)
For instance a record in the database might contain a list of numbers,
"34,234,5" (with no spaces between). This query would be able to select
that record based on the value "34", "234" or "5" regardless of their
positioni in the list (left, middle or right).
Is nice to look up list-relations to records or files in TYPO3 database tables.
$field | string | Field name |
$value | string | Value to find in list |
$table | string | Table in which we are searching (for DBAL detection of quoteStr() method) |
Returns: | string | WHERE clause for a query |
Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.
$searchWords | array | Array of search words |
$fields | array | Array of fields |
$table | string | Table in which we are searching (for DBAL detection of quoteStr() method) |
Returns: | string | WHERE clause for search |
Substitution for PHP function "addslashes()"
Use this function instead of the PHP addslashes() function when you build queries - this will prepare your code for DBAL.
Usage count/core: 105
$str | string | Input string |
$table | string | Table name for which to quote string. Just enter the table that the field-value is selected from (and any DBAL will look up which handler to use and then how to quote the string!). |
Returns: | string | Output string; Quotes (" / ') and \ will be backslashed (or otherwise based on DBAL handler) |
Will convert all values in the one-dimentional array to integers.
Useful when you want to make sure an array contains only integers before imploding them in a select-list.
Usage count/core: 7
$arr | array | Array with values |
Returns: | array | The input array with all values passed through intval() |
@see cleanIntList() |
Will force all entries in the input comma list to integers
Useful when you want to make sure a commalist of supposed integers
really contain only integers; You want to know that when you don't
trust content that could go into an SQL statement.
Usage count/core: 6
$list | string | List of comma-separated values which should be integers |
Returns: | string | The input list but with every value passed through intval() |
@see cleanIntArray() |
Removes the prefix "ORDER BY" from the input string.
This function is used when you call the exec_SELECTquery() function and
want to pass the ORDER BY parameter by can't guarantee that "ORDER BY"
is not prefixed.
Generally; This function provides a work-around to the situation where
you cannot pass only the fields by which to order the result.
Usage count/core: 11
$str | string | eg. "ORDER BY title, uid" |
Returns: | string | eg. "title, uid" |
@see exec_SELECTquery(), stripGroupBy() |
Removes the prefix "GROUP BY" from the input string.
This function is used when you call the SELECTquery() function and want
to pass the GROUP BY parameter by can't guarantee that "GROUP BY" is
not prefixed.
Generally; This function provides a work-around to the situation where
you cannot pass only the fields by which to order the result.
Usage count/core: 1
$str | string | eg. "GROUP BY title, uid" |
Returns: | string | eg. "title, uid" |
@see exec_SELECTquery(), stripOrderBy() |
Takes
the last part of a query, eg. "... uid=123 GROUP BY title ORDER BY
title LIMIT 5,2" and splits each part into a table (WHERE, GROUPBY,
ORDERBY, LIMIT)
Work-around function for use where you know some userdefined end to an
SQL clause is supplied and you need to separate these factors.
Usage count/core: 13
$str | string | Input string |
Returns: | array |
Executes query
mysql() wrapper function
DEPRECIATED - use exec_* functions from this class instead!
Usage count/core: 9
$db | string | Database name |
$query | string | Query to execute |
Returns: | pointer | Result pointer / DBAL object |
Executes query
mysql_query() wrapper function
Usage count/core: 1
$query | string | Query to execute |
Returns: | pointer | Result pointer / DBAL object |
Returns the error status on the last sql() execution
mysql_error() wrapper function
Usage count/core: 32
Returns: | string | MySQL error string. |
Returns the number of selected rows.
mysql_num_rows() wrapper function
Usage count/core: 85
$res | pointer | MySQL result pointer (of SELECT query) / DBAL object |
Returns: | integer | Number of resulting rows. |
Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows.
mysql_fetch_assoc() wrapper function
Usage count/core: 307
$res | pointer | MySQL result pointer (of SELECT query) / DBAL object |
Returns: | array | Associative array of result row. |
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows.
The array contains the values in numerical indices.
mysql_fetch_row() wrapper function
Usage count/core: 56
$res | pointer | MySQL result pointer (of SELECT query) / DBAL object |
Returns: | array | Array with result rows. |
Free result memory
mysql_free_result() wrapper function
Usage count/core: 3
$res | pointer | MySQL result pointer to free / DBAL object |
Returns: | boolean | Returns TRUE on success or FALSE on failure. |
Get the ID generated from the previous INSERT operation
mysql_insert_id() wrapper function
Usage count/core: 13
Returns: | integer | The uid of the last inserted record. |
Returns the number of rows affected by the last INSERT, UPDATE or DELETE query
mysql_affected_rows() wrapper function
Usage count/core: 1
Returns: | integer | Number of rows affected by last query |
Move internal result pointer
mysql_data_seek() wrapper function
Usage count/core: 3
$res | pointer | MySQL result pointer (of SELECT query) / DBAL object |
$seek | integer | Seek result number. |
Returns: | boolean | Returns TRUE on success or FALSE on failure. |
Get the type of the specified field in a result
mysql_field_type() wrapper function
Usage count/core: 2
$res | pointer | MySQL result pointer (of SELECT query) / DBAL object |
$pointer | integer | Field index. |
Returns: | string | Returns the name of the specified field index |
Open a (persistent) connection to a MySQL server
mysql_pconnect() wrapper function
Usage count/core: 12
$TYPO3_db_host | string | Database host IP/domain |
$TYPO3_db_username | string | Username to connect with. |
$TYPO3_db_password | string | Password to connect with. |
Returns: | pointer | Returns a positive MySQL persistent link identifier on success, or FALSE on error. |
Select a MySQL database
mysql_select_db() wrapper function
Usage count/core: 8
$TYPO3_db | string | Database to connect to. |
Returns: | boolean | Returns TRUE on success or FALSE on failure. |
Listing
databases from current MySQL connection. NOTICE: It WILL try to select
those databases and thus break selection of current database.
This doesn't really make sense to transfer to a DBAL layer - this
detection is also PRE-DBAL in many ways since it is only used as a
service function in the 1-2-3 process of the Install Tool. In any case
a lookup should be done in the _DEFAULT handler DBMS then.
Use in Install Tool only!
Usage count/core: 1
Returns: | array | Each entry represents a database name |
Returns the list of tables from the default database, TYPO3_db (quering the DBMS)
In a DBAL this method should 1) look up all tables from the DBMS of the
_DEFAULT handler and then 2) add all tables *configured* to be managed
by other handlers
Usage count/core: 2
Returns: | array | Tables in an array (tablename is in both key and value) |
Returns information about each field in the $table (quering the DBMS)
In a DBAL this should look up the right handler for the table and return compatible information
This function is important not only for the Install Tool but probably
for DBALs as well since they might need to look up table specific
information in order to construct correct queries. In such cases this
information should probably be cached for quick delivery
$tableName | string | Table name |
Returns: | array | Field information in an associative array with fieldname => field row |
Returns information about each index key in the $table (quering the DBMS)
In a DBAL this should look up the right handler for the table and return compatible information
$tableName | string | Table name |
Returns: | array | Key information in a numeric array |
mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!
Usage count/core: 10
$query | string | Query to execute |
Returns: | pointer | Result pointer |
Debug function: Outputs error if any
$func | string | Function calling debug() |
Returns: | void |
This class has functions which generates a difference output of a content string
Currently works only with LINUX/UNIX
Filesize: | 7.6 K |
Func/Classes: | 6 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
This class has functions which generates a difference output of a content string
Currently works only with LINUX/UNIX
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
This will produce a color-marked-up diff output in HTML from the input strings.
$str1 | string | String 1 |
$str2 | string | String 2 |
Returns: | string | Formatted output. |
Produce a diff (with the "diff" application on unix) between two strings
The function will write the two input strings to temporary files, then
execute the diff program, delete the temp files and return the result.
$str1 | string | String 1 |
$str2 | string | String 2 |
Returns: | array | The result from the exec() function call. |
Will bring down the length of strings to < 150 chars if they were longer than 200 chars. This done by preserving the 70 first and last chars and concatenate those strings with "..." and a number indicating the string length
$clearBuffer | string | The input string. |
$last=0 | boolean | If set, it indicates that the string should just end with ... (thus no "complete" ending) |
Returns: | string | Processed string. |
Explodes the input string into words.
This is done by splitting first by lines, then by space char. Each word
will be in stored as a value in an array. Lines will be indicated by
two subsequent empty values.
$str | string | The string input |
Returns: | array | Array with words. |
Adds a space character before and after HTML tags (more precisely any found < or >)
$str | string | String to process |
$rev=0 | boolean | If set, the < > searched for will be < and > |
Returns: | string | Processed string |
The legendary "t3lib_div" class - Miscellaneous functions for general purpose.
Most of the functions does not relate specifically to TYPO3
However a section of functions requires certain TYPO3 features available
See comments in the source.
You are encouraged to use this library in your own scripts!
USE:
The class is intended to be used without creating an instance of it.
So: Don't instantiate - call functions with "t3lib_div::" prefixed the function name.
So use t3lib_div::[method-name] to refer to the functions, eg. 't3lib_div::milliseconds()'
Filesize: | 113 K |
Func/Classes: | 109 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
The legendary "t3lib_div" class - Miscellaneous functions for general purpose.
Most of the functions does not relate specifically to TYPO3
However a section of functions requires certain TYPO3 features available
See comments in the source.
You are encouraged to use this library in your own scripts!
USE:
The class is intended to be used without creating an instance of it.
So: Don't instantiate - call functions with "t3lib_div::" prefixed the function name.
So use t3lib_div::[method-name] to refer to the functions, eg. 't3lib_div::milliseconds()'
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST (that is equalent to 'GP' order)
Strips slashes from all output, both strings and arrays.
This function substitutes t3lib_div::GPvar()
To enhancement security in your scripts, please consider using
t3lib_div::_GET or t3lib_div::_POST if you already know by which method
your data is arriving to the scripts!
$var | string | GET/POST var to return |
Returns: | mixed | POST var named $var and if not set, the GET var of the same name. |
@see GPvar() |
Returns the global GET array (or value from) normalized to contain un-escaped values.
ALWAYS use this API function to acquire the GET variables!
$var='' | string | Optional pointer to value in GET array (basically name of GET var) |
Returns: | mixed | If $var is set it returns the value of $HTTP_GET_VARS[$var]. If $var is blank or zero, returns $HTTP_GET_VARS itself. In any case *slashes are stipped from the output!* |
@see _POST(), _GP(), _GETset() |
Returns the global POST array (or value from) normalized to contain un-escaped values.
ALWAYS use this API function to acquire the POST variables!
$var='' | string | Optional pointer to value in POST array (basically name of POST var) |
Returns: | mixed | If $var is set it returns the value of $HTTP_POST_VARS[$var]. If $var is blank or zero, returns $HTTP_POST_VARS itself. In any case *slashes are stipped from the output!* |
@see _GET(), _GP() |
Writes input value to $HTTP_GET_VARS / $_GET
$inputGet | array | Array to write to $HTTP_GET_VARS / $_GET. Values should NOT be escaped at input time (but will be escaped before writing according to TYPO3 standards). |
$key='' | string | Alternative key; If set, this will not set the WHOLE GET array, but only the key in it specified by this value! |
Returns: | void |
GET/POST variable
Returns the 'GLOBAL' value of incoming data from POST or GET, with priority to POST (that is equalent to 'GP' order)
Strips slashes of string-outputs, but not arrays UNLESS $strip is set.
If $strip is set all output will have escaped characters unescaped.
Usage: 686
$var | string | GET/POST var to return |
$strip=0 | boolean | If set, values are stripped of return values that are *arrays!* - string/integer values returned are always strip-slashed() |
Returns: | mixed | POST var named $var and if not set, the GET var of the same name. |
@depreciated Use t3lib_div::_GP instead (ALWAYS delivers a value with un-escaped values!) | ||
@see _GP() |
Sets global variables from HTTP_POST_VARS or HTTP_GET_VARS
Usage: 9
$list | string | List of GET/POST var keys to set globally |
$strip=0 | boolean | If set, values are passed through stripslashes() |
Returns: | void | |
@depreciated |
Returns the GET/POST global arrays merged with POST taking precedence.
Usage: 1
$var | string | Key (variable name) from GET or POST vars |
Returns: | array | Returns the GET vars merged recursively onto the POST vars. |
@depreciated |
Compressing a GIF file if not already LZW compressed
This function is a workaround for the fact that ImageMagick and/or GD
does not compress GIF-files to their minimun size (that is RLE or no
compression used)
The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file
GIF:
If $type is not set, the compression is done with ImageMagick (provided
that $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] is pointing to
the path of a lzw-enabled version of 'convert') else with GD (should be
RLE-enabled!)
If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively
PNG:
No changes.
$theFile is expected to be a valid GIF-file!
The function returns a code for the operation.
Usage: 11
$theFile | string | Filepath |
$type | string | See description of function |
Returns: | string | Returns "GD" if GD was used, otherwise "IM" if ImageMagick was used. If nothing done at all, it returns empty string. |
@internal |
Converts a png file to gif
This converts a png file to gif IF the FLAG $GLOBALS['TYPO3_CONF_VARS']['FE']['png_to_gif'] is set true.
Usage: 5
$theFile | string | $theFile the filename with path |
Returns: | string | new filename |
@internal |
Returns filename of the png/gif version of the input file (which can be png or gif).
If input file type does not match the wanted output type a conversion is made and temp-filename returned.
Usage: 1
$theFile | string | Filepath of image file |
$output_png=0 | boolean | If set, then input file is converted to PNG, otherwise to GIF |
Returns: | string | If the new image file exists, it's filepath is returned |
@internal |
Truncate string
Returns a new string of max. $chars length.
If the string is longer, it will be truncated and appended with '...'.
Usage: 119
$string | string | $string string to truncate |
$chars | integer | $chars must be an integer of at least 4 |
$preStr='...' | string | String to append to the the output if it is truncated, default is '...' |
Returns: | string | new string |
@see fixed_lgd_pre() |
Truncate string
Returns a new string of max. $chars length.
If the string is longer, it will be truncated and prepended with '...'.
This works like fixed_lgd, but is truncated in the start of the string instead of the end
Usage: 19
$string | string | $string string to truncate |
$chars | integer | $chars must be an integer of at least 4 |
Returns: | string | new string |
@see fixed_lgd() |
Breaks up the text for emails
Usage: 1
$str | string | The string to break up |
$implChar="\n" | string | The string to implode the broken lines with (default/typically \n) |
$charWidth=76 | integer | The line length |
Returns: | string |
Breaks up a single line of text for emails
Usage: 3
$str | string | The string to break up |
$implChar="\n" | string | The string to implode the broken lines with (default/typically \n) |
$charWidth=76 | integer | The line length |
Returns: | string | |
@see breakTextForEmail() |
Match IP number with list of numbers with wildcard
Usage: 8
$baseIP | string | $baseIP is the current remote IP address for instance, typ. REMOTE_ADDR |
$list | string | $list is a comma-list of IP-addresses to match with. *-wildcard allowed instead of number, plus leaving out parts in the IP number is accepted as wildcard (eg. 192.168.*.* equals 192.168) |
Returns: | boolean | True if an IP-mask from $list matches $baseIP |
Check for item in list
Check if an item exists in a comma-separated list of items.
Usage: 166
$in_list | string | $in_list comma-separated list of items (string) |
$item | string | $item item to check for |
Returns: | boolean | true if $item is in $in_list |
Removes an item from a comma-separated list of items.
Usage: 1
$element | string | $element element to remove |
$list | string | $list comma-separated list of items (string) |
Returns: | string | new comma-separated list of items |
Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is 'false' then the $zeroValue is applied.
Usage: 226
$theInt | integer | Input value |
$min | integer | Lower limit |
$max=2000000000 | integer | Higher limit |
$zeroValue=0 | integer | Default value if input is false. |
Returns: | integer | The input value forced into the boundaries of $min and $max |
Returns the $integer if greater than zero, otherwise returns zero.
Usage: 1
$theInt | integer | Integer string to process |
Returns: | integer |
Returns an integer from a three part version number, eg '4.12.3' -> 4012003
Usage: 2
$verNumberStr | string | Version number on format x.x.x |
Returns: | integer | Integer version of version number (where each part can count to 999) |
Makes a positive integer hash out of the first 7 chars from the md5 hash of the input
Usage: 0
$str | string | String to md5-hash |
Returns: | integer | Returns 28bit integer-hash |
Takes a comma-separated list and removes all duplicates
Usage: 16
$in_list | string | $in_list is a comma-separated list of values. |
Returns: | string | Returns the list without any duplicates of values, space around values are trimmed |
Splits a reference to a file in 5 parts
Usage: 43
$fileref | string | Filename/filepath to be analysed |
Returns: | array | Contains keys [path], [file], [filebody], [fileext], [realFileext] |
Returns the directory part of a path without trailing slash
If there is no dir-part, then an empty string is returned.
Behaviour:
'/dir1/dir2/script.php' => '/dir1/dir2'
'/dir1/' => '/dir1'
'dir1/script.php' => 'dir1'
'd/script.php' => 'd'
'/script.php' => ''
'' => ''
Usage: 5
$path | string | Directory name / path |
Returns: | string | Processed input value. See function description. |
Modifies a HTML Hex color by adding/subtracting $R,$G and $B integers
Usage: 37
$color | string | A hexadecimal color code, #xxxxxx |
$R | integer | Offset value 0-255 |
$G | integer | Offset value 0-255 |
$B | integer | Offset value 0-255 |
Returns: | string | A hexadecimal color code, #xxxxxx, modified according to input vars |
@see modifyHTMLColorAll() |
Modifies a HTML Hex color by adding/subtracting $all integer from all R/G/B channels
Usage: 4
$color | string | A hexadecimal color code, #xxxxxx |
$all | integer | Offset value 0-255 for all three channels. |
Returns: | string | A hexadecimal color code, #xxxxxx, modified according to input vars |
@see modifyHTMLColor() |
Removes comma (if present) in the end of string
Usage: 4
$string | string | String from which the comma in the end (if any) will be removed. |
Returns: | string |
strtoupper which converts danish (and other characters) characters as well
(Depreciated, use PHP function with locale settings instead or for HTML
output, wrap your content in <span
class="uppercase">...</span>)
Usage: 4
$string | string | String to process |
Returns: | string |
Change umlaut characters to plain ASCII with normally two character target
Only known characters will be converted, so don't expect a result for any character.
Works only for western europe single-byte charsets!
ä => ae, Ö => Oe
$str | string | String to convert. |
Returns: | string |
Returns the first 10 positions of the MD5-hash (changed from 6 to 10 recently)
Usage: 43
$input | string | Input string to be md5-hashed |
$len=10 | integer | The string-length of the output |
Returns: | string | Substring of the resulting md5-hash, being $len chars long (from beginning) |
Tests if the input is an integer.
Usage: 74
$var | mixed | Any input variable to test. |
Returns: | boolean | Returns true if string is an integer |
Returns true if the first part of $str matches the string $partStr
Usage: 58
$str | string | Full string to check |
$partStr | string | Reference string which must be found as the "first part" of the full string |
Returns: | boolean | True if $partStr was found to be equal to the first part of $str |
Formats the input integer $sizeInBytes as bytes/kilobytes/megabytes (-/K/M)
Usage: 54
$sizeInBytes | integer | Number of bytes to format. |
$labels='' | string | Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value) |
Returns: | string | Formatted representation of the byte number, for output. |
Returns microtime input to milliseconds
Usage: 2
$microtime | string | Microtime |
Returns: | integer | Microtime input string converted to an integer (milliseconds) |
This splits a string by the chars in $operators (typical /+-*) and returns an array with them in
Usage: 2
$string | string | Input string, eg "123 + 456 / 789 - 4" |
$operators | string | Operators to split by, typically "/+-*" |
Returns: | array | Array with operators and operands separated. |
@see tslib_cObj::calc(), tslib_gifBuilder::calcOffset() |
Calculates the input by +,-,*,/,%,^ with priority to + and -
Usage: 1
$string | string | Input string, eg "123 + 456 / 789 - 4" |
Returns: | integer | Calculated value. Or error string. |
@see calcParenthesis() |
Calculates the input with parenthesis levels
Usage: 2
$string | string | Input string, eg "(123 + 456) / 789 - 4" |
Returns: | integer | Calculated value. Or error string. |
@see calcPriority(), tslib_cObj::stdWrap() |
Inverse version of htmlspecialchars()
Usage: 2
$value | string | Value where >, <, " and & should be converted to regular chars. |
Returns: | string | Converted result. |
Re-converts HTML entities if they have been converted by htmlspecialchars()
$str | string | String which contains eg. "&amp;" which should stay "&". Or "&#1234;" to "Ӓ". Or "&#x1b;" to "" |
Returns: | string | Converted result. |
This function is used to escape any ' -characters when transferring text to JavaScript!
Usage: 6
$string | string | String to escape |
$extended=0 | boolean | If set, also backslashes are escaped. |
$char="'" | string | The character to escape, default is ' (single-quote) |
Returns: | string | Processed input string |
Version of rawurlencode() where all spaces (%20) are re-converted to space-characters.
Usefull when passing text to JavaScript where you simply url-encode it
to get around problems with syntax-errors, linebreaks etc.
Usage: 8
$str | string | String to raw-url-encode with spaces preserved |
Returns: | string | Rawurlencoded result of input string, but with all %20 (space chars) converted to real spaces. |
rawurlencode which preserves "/" chars
Usefull when filepaths should keep the "/" chars, but have all other special chars encoded.
$str | string | Input string |
Returns: | string | Output string |
Checking syntax of input email address
Usage: 4
string | Input string to evaluate | |
Returns: | boolean | Returns true if the $email address (input string) is valid; Has a "@", domain name with at least one period and only allowed a-z characters. |
Formats a string for output between <textarea>-tags
All content outputted in a textarea form should be passed through this function
Not only is the content htmlspecialchar'ed on output but there is also
a single newline added in the top. The newline is necessary because
browsers will ignore the first newline after <textarea> if that
is the first character. Therefore better set it!
Usage: 30
$content | string | Input string to be formatted. |
Returns: | string | Formatted for <textarea>-tags |
Check if an item exists in an array
Please note that the order of parameters is reverse compared to the php4-function in_array()!!!
Usage: 3
$in_array | array | $in_array one-dimensional array of items |
$item | string | $item item to check for |
Returns: | boolean | true if $item is in the one-dimensional array $in_array |
@internal |
Explodes a $string delimited by $delim and passes each item in the array through intval().
Corresponds to explode(), but with conversion to integers for all values.
Usage: 86
$delim | string | Delimiter string to explode with |
$string | string | The string to explode |
Returns: | array | Exploded values, all converted to integers |
Reverse explode which explodes the string counting from behind.
Thus t3lib_div::revExplode(':','my:words:here',2) will return array('my:words','here')
Usage: 6
$delim | string | Delimiter string to explode with |
$string | string | The string to explode |
$count=0 | integer | Number of array entries |
Returns: | array | Exploded values |
Explodes a string and trims all values for whitespace in the ends.
If $onlyNonEmptyValues is set, then all blank ('') values are removed.
Usage: 239
$delim | string | Delimiter string to explode with |
$string | string | The string to explode |
$onlyNonEmptyValues=0 | boolean | If set, all empty values (='') will NOT be set in output |
Returns: | array | Exploded values |
Takes a one-dimensional array and returns an array where the values are unique
The keys in the array are substituted with some md5-hashes
If the value is trim(empty), the value is ignored.
Values are trimmed
(Depreciated, use PHP function array_unique instead)
Usage: 2
$valueArray | array | Array of values to make unique |
Returns: | array | |
@depreciated |
Removes the value $cmpValue from the $array if found there. Returns the modified array
Usage: 2
$array | array | Array containing the values |
$cmpValue | string | Value to search for and if found remove array entry where found. |
Returns: | array | Output array with entries removed if search string is found |
Implodes a multidim-array into GET-parameters (eg. ¶m[key][key2]=value2¶m[key][key3]=value3)
Usage: 24
$name | string | Name prefix for entries. Set to blank if you wish none. |
$theArray | array | The (multidim) array to implode |
$str='' | boolean | If set, all values that are blank (='') will NOT be imploded |
$skipBlank=0 | boolean | If set, parameters which were blank strings would be removed. |
$rawurlencodeParamName=0 | boolean | If set, the param name itselt (for example "param[key][key2]") would be rawurlencoded as well. |
Returns: | string | Imploded result, fx. ¶m[key][key2]=value2¶m[key][key3]=value3 |
Returns an array with selected keys from incoming data.
(Better read source code if you want to find out...)
Usage: 3
$varList | string | List of variable/key names |
$getArray | array | Array from where to get values based on the keys in $varList |
$GPvarAlt=1 | boolean | If set, then t3lib_div::_GP() is used to fetch the value if not found (isset) in the $getArray |
Returns: | array | Output array with selected variables. |
AddSlash array
This function traverses a multidimentional array and adds slashes to the values.
NOTE that the input array is and argument by reference.!!
Twin-function to stripSlashesOnArray
Usage: 6
&$theArray | array | Multidimensional input array, (REFERENCE!) |
Returns: | array |
StripSlash array
This function traverses a multidimentional array and strips slashes to the values.
NOTE that the input array is and argument by reference.!!
Twin-function to addSlashesOnArray
Usage: 7
&$theArray | array | Multidimensional input array, (REFERENCE!) |
Returns: | array |
Either slashes ($cmd=add) or strips ($cmd=strip) array $arr depending on $cmd
Usage: 6
$arr | array | Multidimensional input array |
$cmd | string | "add" or "strip", depending on usage you wish. |
Returns: | array |
Merges
two arrays recursively, overruling similar the values in the first
array ($arr0) with the values of the second array ($arr1)
In case of identical keys, ie. keeping the values of the second.
Usage: 26
$arr0 | array | First array |
$arr1 | array | Second array, overruling the first array |
$notAddKeys=0 | boolean | If set, keys that are NOT found in $arr0 (first array) will not be set. Thus only existing value can/will be overruled from second array. |
Returns: | array | Resulting array where $arr1 values has overruled $arr0 values |
An array_merge function where the keys are NOT renumbered as they happen to be with the real php-array_merge function
Usage: 27
$arr1 | array | First array |
$arr2 | array | Second array |
Returns: | array | Merged result. |
Takes a row and returns a CSV string of the values with $delim (default is ,) and $quote (default is ") as separator chars.
Usage: 5
$row | array | Input array of values |
$delim=',' | string | Delimited, default is comman |
$quote='"' | string | Quote-character to wrap around the values. |
Returns: | string | A single line of CSV |
$tag is either a whole tag (eg '<TAG OPTION ATTRIB=VALUE>') or the parameterlist (ex ' OPTION ATTRIB=VALUE>')
Returns an array with all attributes as keys. Attributes are only lowercase a-z
If a attribute is empty (I call it 'an option'), then the value for the key is empty. You can check if it existed with isset()
Usage: 9
$tag | string | HTML-tag string (or attributes only) |
Returns: | array | Array with the attribute values. |
Returns
an array with the 'components' from an attribute list from an HTML tag.
The result is normally analyzed by get_tag_attributes
Removes tag-name if found
Usage: 1
$tag | string | HTML-tag string (or attributes only) |
Returns: | array | Array with the attribute values. |
@internal |
Implodes attributes in the array $arr for an attribute list in eg. and HTML tag (with quotes)
Usage: 10
$arr | array | Array with attribute key/value pairs, eg. "bgcolor"=>"red", "border"=>0 |
$xhtmlSafe=FALSE | boolean | If set the resulting attribute list will have a) all attributes in lowercase (and duplicates weeded out, first entry taking precedence) and b) all values htmlspecialchar()'ed. It is recommended to use this switch! |
$dontOmitBlankAttribs=FALSE | boolean | If true, don't check if values are blank. Default is to omit attributes with blank values. |
Returns: | string | Imploded attributes, eg. 'bgcolor="red" border="0"' |
Wraps JavaScript code XHTML ready with <script>-tags
Automatic re-identing of the JS code is done by using the first line as ident reference.
This is nice for identing JS code with PHP code on the same level.
$string | string | JavaScript code |
$linebreak=TRUE | boolean | Wrap script element in linebreaks? Default is TRUE. |
Returns: | string | The wrapped JS code, ready to put into a XHTML page |
@author Ingmar Schlecht <ingmars@web.de> | ||
@author René Fritz <r.fritz@colorcube.de> |
Parses XML input into a PHP array with associative keys
$string | string | XML data input |
$depth=999 | integer | Number of element levels to resolve the XML into an array. Any further structure will be set as XML. |
Returns: | mixed | The array with the parsed structure unless the XML parser returns with an error in which case the error message string is returned. |
@author bisqwit at iki dot fi dot not dot for dot ads dot invalid / http://dk.php.net/xml_parse_into_struct + kasper@typo3.com |
Converts a PHP array into an XML string.
The XML output is optimized for readability since associative keys are used as tagnames.
This also means that only alphanumeric characters are allowed in the
tag names AND only keys NOT starting with numbers (so watch your usage
of keys!). However there are options you can set to avoid this problem.
Numeric keys are stored with the default tagname "numIndex" but can be overridden to other formats)
The function handles input values from the PHP array in a binary-safe
way; All characters below 32 (except 9,10,13) will trigger the content
to be converted to a base64-string
The PHP variable type of the data is IS preserved as long as the types
are strings, arrays, integers and booleans. Strings are the default
type unless the "type" attribute is set.
The output XML has been tested with the PHP XML-parser and parses OK under all tested circumstances.
However using MSIE to read the XML output didn't always go well: One
reason could be that the character encoding is not observed in the PHP
data. The other reason may be if the tag-names are invalid in the eyes
of MSIE. Also using the namespace feature will make MSIE break parsing.
There might be more reasons...
$array | array | The input PHP array with any kind of data; text, binary, integers. Not objects though. |
$NSprefix='' | string | tag-prefix, eg. a namespace prefix like "T3:" |
$level=0 | integer | Current recursion level. Don't change, stay at zero! |
$docTag='phparray' | string | Alternative document tag. Default is "phparray". |
$spaceInd=0 | integer | If set, the number of spaces corresponding to this number is used for indenting, otherwise a single chr(9) (TAB) is used |
$options=array() | array | Options for the compilation. Key "useNindex" => 0/1 (boolean: whether to use "n0, n1, n2" for num. indexes); Key "useIndexTagForNum" => "[tag for numerical indexes]"; Key "useIndexTagForAssoc" => "[tag for associative indexes"; Key "parentTagMap" => array('parentTag' => 'thisLevelTag') |
$parentTagName='' | string | Parent tag name. Don't touch. |
Returns: | string | An XML string made from the input content in the array. |
@see xml2array() |
Converts an XML string to a PHP array.
This is the reverse function of array2xml()
$string | string | XML content to convert into an array |
$NSprefix='' | string | The tag-prefix resolve, eg. a namespace like "T3:" |
Returns: | mixed | If the parsing had errors, a string with the error message is returned. Otherwise an array with the content. |
@see array2xml() |
This implodes an array of XML parts (made with xml_parse_into_struct()) into XML again.
$vals | array | A array of XML parts, see xml2tree |
Returns: | string | Re-compiled XML data. |
Extract the encoding scheme as found in the first line of an XML document (typically)
$xmlData | string | XML data |
Returns: | string | Encoding scheme (lowercase), if found. |
Reads the file or url $url and returns the content
If you are having trouble with proxys when reading URLs you can
configure your way out of that with settings like
$TYPO3_CONF_VARS['SYS']['curlUse'] etc.
Usage: 79
$url | string | Filepath/URL to read |
Returns: | string | The content from the resource given as input. |
Writes $content to the file $file
Usage: 31
$file | string | Filepath to write to |
$content | string | Content to write |
Returns: | boolean | True if the file was successfully opened and written to. |
Returns an array with the names of folders in a specific path
Will return 'error' (string) if there were an error with reading directory content.
Usage: 13
$path | string | Path to list directories from |
Returns: | array | Returns an array with the directory entries as values. If no path, the return value is nothing. |
Returns an array with the names of files in a specific path
Usage: 17
$path | string | $path: Is the path to the file |
$extensionList='' | string | $extensionList is the comma list of extensions to read only (blank = all) |
$prependPath=0 | boolean | If set, then the path is prepended the filenames. Otherwise only the filenames are returned in the array |
$order='' | string | $order is sorting: 1= sort alphabetically, 'mtime' = sort by modification time. |
Returns: | array | Array of the files found |
Recursively gather all files and folders of a path.
$fileArr | array | $fileArr: Empty input array (will have files added to it) |
$path | string | $path: The path to read recursively from (absolute) |
$extList='' | string | $extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected. |
$regDirs=0 | boolean | $regDirs: If set, directories are also included in output. |
$recursivityLevels=99 | integer | $recursivityLevels: The number of levels to dig down... |
Returns: | array | An array with the found files/directories. |
Removes the absolute part of all files/folders in fileArr
$fileArr | array | $fileArr: The file array to remove the prefix from |
$prefixToRemove | string | $prefixToRemove: The prefix path to remove (if found as first part of string!) |
Returns: | array | The input $fileArr processed. |
Fixes a path for windows-backslashes and reduces double-slashes to single slashes
Usage: 2
$theFile | string | File path to process |
Returns: | string |
Resolves "../" sections in the input path string
$pathStr | string | File path in which "/../" is resolved |
Returns: | string |
Prefixes a URL used with 'header-location' with 'http://...' depending on whether it has it already.
- If already having a scheme, nothing is prepended
- If having REQUEST_URI slash '/', then prefixing 'http://[host]' (relative to host)
- Otherwise prefixed with TYPO3_REQUEST_DIR (relative to current dir / TYPO3_REQUEST_DIR)
Usage: 31
$path | string | URL / path to prepend full URL addressing to. |
Returns: | string |
Returns a string with a list of ascii-values for the first $characters characters in $string
Usage: 5
$string | string | String to show ASCII value for |
$characters=100 | integer | Number of characters to show |
Returns: | string | The string with ASCII values in separated by a space char. |
@internal |
Returns HTML-code, which is a visual representation of a multidimensional array
use t3lib_div::print_array() in order to print an array
Returns false if $array_in is not an array
Usage: 27
$array_in | array | Array to view |
Returns: | string | HTML output |
Prints an array
Usage: 28
$array_in | array | Array to print visually (in a table). |
Returns: | void | |
@internal | ||
@see view_array() |
Makes debug output
Prints $var in bold between two vertical lines
If not $var the word 'debug' is printed
If $var is an array, the array is printed by t3lib_div::print_array()
Usage: 8
$var="" | mixed | Variable to print |
$brOrHeader=0 | mixed | If the parameter is a string it will be used as header. Otherwise number of break tags to apply after (positive integer) or before (negative integer) the output. |
Returns: | void |
Returns the HOST+DIR-PATH of the current script (The URL, but without 'http://' and without script-filename)
Usage: 1
Returns: | string |
Returns the link-url to the current script.
In $getParams you can set associative keys corresponding to the
get-vars you wish to add to the url. If you set them empty, they will
remove existing get-vars from the current url.
REMEMBER to always htmlspecialchar() content in href-properties to
ampersands get converted to entities (XHTML requirement and XSS
precaution)
Usage: 54
$getParams=array() | array | Array of GET parameters to include |
Returns: | string |
Takes
a full URL, $url, possibly with a querystring and overlays the
$getParams arrays values onto the quirystring, packs it all together
and returns the URL again.
So basically it adds the parameters in $getParams to an existing URL, $url
Usage: 2
$url | string | URL string |
$getParams=array() | array | Array of key/value pairs for get parameters to add/overrule with. Can be multidimensional. |
Returns: | string | Output URL with added getParams. |
Abstraction
method which returns System Environment Variables regardless of server
OS, CGI/MODULE version etc. Basically this is SERVER variables for most
of them.
This should be used instead of getEnv() and HTTP_SERVER_VARS/ENV_VARS to get reliable values for all situations.
Usage: 226
$getEnvName | string | Name of the "environment variable"/"server variable" you wish to use. Valid values are SCRIPT_NAME, SCRIPT_FILENAME, REQUEST_URI, PATH_INFO, REMOTE_ADDR, REMOTE_HOST, HTTP_REFERER, HTTP_HOST, HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE, QUERY_STRING, TYPO3_DOCUMENT_ROOT, TYPO3_HOST_ONLY, TYPO3_HOST_ONLY, TYPO3_REQUEST_HOST, TYPO3_REQUEST_URL, TYPO3_REQUEST_SCRIPT, TYPO3_REQUEST_DIR, TYPO3_SITE_URL, _ARRAY |
Returns: | string | Value based on the input key, independent of server/os environment. |
milliseconds
microtime recalculated to t3lib_div::milliseconds(1/1000 sec)
Usage: 39
Returns: | integer |
Client Browser Information
Usage: 4
$useragent='' | string | Alternative User Agent string (if empty, t3lib_div::getIndpEnv('HTTP_USER_AGENT') is used) |
Returns: | array | Parsed information about the HTTP_USER_AGENT in categories BROWSER, VERSION, SYSTEM and FORMSTYLE |
Returns the absolute filename of $filename.
Decodes the prefix EXT: for TYPO3 Extensions.
Usage: 9
$filename | string | The input filename/filepath to evaluate |
$onlyRelative=1 | boolean | If $onlyRelative is set (which it is by default), then only return values relative to the current PATH_site is accepted. |
$relToTYPO3_mainDir=0 | boolean | If $relToTYPO3_mainDir is set, then relative paths are relative to PATH_typo3 constant - otherwise (default) they are relative to PATH_site |
Returns: | string | Returns the absolute filename of $filename IF valid, otherwise blank string. |
Returns true if no '//', '..' or '\' is in the $theFile
This should make sure that the path is not pointing 'backwards' and further doesn't contain double/back slashes.
So it's compatible with the UNIX style path strings valid for TYPO3 internally.
Usage: 8
$theFile | string | Filepath to evaluate |
Returns: | boolean | True, if no '//', '..' or '\' is in the $theFile |
@todo Possible improvement: Should it rawurldecode the string first to check if any of these characters is encoded ? |
Checks if the $path is absolute or relative (detecting either '/' or 'x:/' as first part of string) and returns true if so.
Usage: 9
$path | string | Filepath to evaluate |
Returns: | boolean |
Returns true if the path is absolute, without backpath '..' and within the PATH_site OR within the lockRootPath
Usage: 1
$path | string | Filepath to evaluate |
Returns: | boolean |
Verifies the input filename againts the 'fileDenyPattern'. Returns true if OK.
Usage: 2
$filename | string | Filepath to evaluate |
Returns: | boolean |
Moves $source file to $destination if uploaded, otherwise try to make a copy
Usage: 3
$source | string | Source file, absolute path |
$destination | string | Destination file, absolute path |
Returns: | boolean | Returns true if the file was moved. |
@coauthor Dennis Petersen <fessor@software.dk> | ||
@see upload_to_tempfile() |
Will
move an uploaded file (normally in "/tmp/xxxxx") to a temporary
filename in PATH_site."typo3temp/" from where TYPO3 can use it under
safe_mode.
Use this function to move uploaded files to where you can work on them.
REMEMBER to use t3lib_div::unlink_tempfile() afterwards - otherwise
temp-files will build up! They are NOT automatically deleted in
PATH_site."typo3temp/"!
$uploadedFileName | string | The temporary uploaded filename, eg. $GLOBALS['HTTP_POST_FILES']['[upload field name here]']['tmp_name'] |
Returns: | string | If a new file was successfully created, return its filename, otherwise blank string. |
@see unlink_tempfile(), upload_copy_move() |
Deletes (unlink) a temporary filename in 'PATH_site."typo3temp/"' given as input.
The function will check that the file exists, is in
PATH_site."typo3temp/" and does not contain back-spaces ("../") so it
should be pretty safe.
Use this after upload_to_tempfile() or tempnam() from this class!
$uploadedTempFileName | string | Filepath for a file in PATH_site."typo3temp/". Must be absolute. |
Returns: | boolean | Returns true if the file was unlink()'ed |
@see upload_to_tempfile(), tempnam() |
Create temporary filename (Create file with unique file name)
This function should be used for getting temporary filenames - will make your applications safe for open_basedir = on
REMEMBER to delete the temporary files after use! This is done by t3lib_div::unlink_tempfile()
$filePrefix | string | Prefix to temp file (which will have no extension btw) |
Returns: | string | result from PHP function tempnam() with PATH_site.'typo3temp/' set for temp path. |
@see unlink_tempfile() |
standard authentication code - can't remember what it's used for.
Usage: 2
$uid_or_record | mixed | Uid (integer) or record (array) |
$fields='' | string | List of fields from the record if that is given. |
Returns: | string | MD5 hash of 8 chars. |
@internal |
Loads the $TCA (Table Configuration Array) for the $table
Requirements:
1) must be configured table (the ctrl-section configured),
2) columns must not be an array (which it is always if whole table loaded), and
3) there is a value for dynamicConfigFile (filename in typo3conf)
Usage: 92
$table | string | Table name for which to load the full TCA array part into the global $TCA |
Returns: | void |
Looks
for a sheet-definition in the input data structure array. If found it
will return the data structure for the sheet given as $sheet (if found).
If the sheet definition is in an external file that file is parsed and the data structure inside of that is returned.
$dataStructArray | array | Input data structure, possibly with a sheet-definition and references to external data source files. |
$sheet='sDEF' | string | The sheet to return, preferably. |
Returns: | array | An array with two num. keys: key0: The data structure is returned in this key (array) UNLESS an error happend in which case an error string is returned (string). key1: The used sheet key value! |
Resolves ALL sheet definitions in dataStructArray
If no sheet is found, then the default "sDEF" will be created with the dataStructure inside.
$dataStructArray | array | Input data structure, possibly with a sheet-definition and references to external data source files. |
Returns: | array | Output data structure with all sheets resolved as arrays. |
Calls a userdefined function/method in class
Such a function/method should look like this: "function proc(&$params, &$ref) {...}"
Usage: 3
$funcName | string | Method reference, [class]->[method] or [function]. You can prefix this reference with "[file-reference]:" and t3lib_div::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:tx_realurl->>encodeSpURL". Finally; for method references the normal operator "->" creates a new instance each time; if you use "->>" instead you will reuse the previous instance of the object identified by the full reference string (meaning; if you call another method in the same class another object is created for that). |
&$params | mixed | Parameters to be pass along (typically an array) (REFERENCE!) |
&$ref | mixed | Reference to be passed along (typically "$this" - being a reference to the calling object) (REFERENCE!) |
$checkPrefix='user_' | string | Required prefix of class or function name |
$silent=0 | boolean | If set, not debug() error message is shown if class/function is not present. |
Returns: | mixed | Content from method/function call |
Find the best service and check if it works.
Returns object of the service class.
$serviceType | string | Type of service (service key). |
$serviceSubType='' | string | Sub type like file extensions or similar. Defined by the service. |
$excludeServiceKeys='' | string | List of service keys which should be exluded in the search for a service. |
Returns: | object | The service object or an array with error info's. |
@author René Fritz <r.fritz@colorcube.de> |
Return classname for new instance
Takes the class-extensions API of TYPO3 into account
Usage: 18
$className | string | Base Class name to evaluate |
Returns: | string | Final class name to instantiate with "new [classname]" |
Simple substitute for the PHP function mail().
The fifth parameter, $enc, will allow you to specify 'base64' encryption for the output (set $enc=base64)
Further the output has the charset set to ISO-8859-1 by default.
Usage: 4
string | Email address to send to. (see PHP function mail()) | |
$subject | string | Subject line, non-encoded. (see PHP function mail()) |
$message | string | Message content, non-encoded. (see PHP function mail()) |
$headers='' | string | Headers, separated by chr(10) |
$enc='' | string | Encoding type: "base64", "quoted-printable", "8bit". If blank, no encoding will be used, no encoding headers set. |
$charset='ISO-8859-1' | string | Charset used in encoding-headers (only if $enc is set to a valid value which produces such a header) |
$dontEncodeSubject=0 | boolean | If set, the content of $subject will not be encoded. |
Returns: | void |
Implementation of quoted-printable encode.
This functions is buggy. It seems that in the part where the lines are
breaked every 76th character, that it fails if the break happens right
in a quoted_printable encode character!
(Originally taken from class.t3lib_htmlmail.php - which may be updated if this function should ever be improved!
See RFC 1521, section 5.1 Quoted-Printable Content-Transfer-Encoding
Usage: 2
$string | string | Content to encode |
$maxlen=76 | integer | Length of the lines, default is 76 |
Returns: | string | The QP encoded string |
Takes
a clear-text message body for a plain text email, finds all 'http://'
links and if they are longer than 76 chars they are converted to a
shorter URL with a hash parameter. The real parameter is stored in the
database and the hash-parameter/URL will be redirected to the real
parameter when the link is clicked.
This function is about preserving long links in messages.
Usage: 3
$message | string | Message content |
$urlmode='76' | string | URL mode; "76" or "all" |
$index_script_url='' | string | URL of index script (see makeRedirectUrl()) |
Returns: | string | Processed message content |
@see makeRedirectUrl() |
Subfunction for substUrlsInPlainText() above.
Usage: 2
$inUrl | string | Input URL |
$l=0 | integer | URL string length limit |
$index_script_url='' | string | URL of "index script" - the prefix of the "?RDCT=..." parameter. If not supplyed it will default to t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') |
Returns: | string | Processed URL |
@internal |
Function to compensate for FreeType2 96 dpi
Usage: 16
$font_size | integer | Fontsize for freetype function call |
Returns: | integer | Compensated fontsize based on $GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'] |
Developer
log; This should be implemented around the source code, both frontend
and backend, logging everything from the flow through an application,
messages, results from comparisons to fatal errors.
The result is meant to make sense to developers during development or debugging of a site.
The idea is that this function is only a wrapper for external
extensions which can set a hook which will be allowed to handle the
logging of the information to any format they might wish and with any
kind of filter they would like.
If you want to implement the devLog in your applications, simply add lines like:
if (TYPO3_DLOG) t3lib_div::devLog('[write message in english here]', 'extension key');
$msg | string | Message (in english). |
$extKey | string | Extension key (from which extension you are calling the log) |
$severity=0 | integer | Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message |
$dataVar=FALSE | array | Additional data you want to pass to the logger. |
Returns: | void |
Extension Management functions
This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');
Filesize: | 38 K |
Func/Classes: | 32 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Extension Management functions
This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns true if the extension with extension key $key is loaded.
$key | string | Extension key to test |
$exitOnError=0 | boolean | If $exitOnError is true and the extension is not loaded the function will die with an error message |
Returns: | boolean |
Returns the absolute path to the extension with extension key $key
If the extension is not loaded the function will die with an error message
Useful for internal fileoperations
$key | string | Extension key |
$script='' | string | $script is appended to the output if set. |
Returns: | string |
Returns the relative path to the extension as measured from from the TYPO3_mainDir
If the extension is not loaded the function will die with an error message
Useful for images and links from backend
$key | string | Extension key |
Returns: | string |
Returns the relative path to the extension as measured from the PATH_site (frontend)
If the extension is not loaded the function will die with an error message
Useful for images and links from the frontend
$key | string | Extension key |
Returns: | string |
Returns the correct class name prefix for the extension key $key
$key | string | Extension key |
Returns: | string | |
@internal |
Adding fields to an existing table definition in $TCA
Adds an array with $TCA column-configuration to the $TCA-entry for that table.
This function adds the configuration needed for rendering of the field
in TCEFORMS - but it does NOT add the field names to the types lists!
So to have the fields displayed you must also call fx. addToAllTCAtypes or manually add the fields to the types list.
FOR USE IN ext_tables.php FILES
$table | string | $table is the table name of a table already present in $TCA with a columns section |
$columnArray | array | $columnArray is the array with the additional columns (typical some fields an extension wants to add) |
$addTofeInterface=0 | boolean | If $addTofeInterface is true the list of fields are also added to the fe_admin_fieldList. |
Returns: | void |
Makes fields visible on the form, adding them to the end.
Adds a string $str (comma list of field names) to all
["types"][xxx]["showitem"] entries for table $table (unless limited by
$specificTypesList)
This is needed to have new fields shown automatically in the TCEFORMS of a record from $table.
Typically this function is called after having added new columns (database fields) with the addTCAcolumns function
FOR USE IN ext_tables.php FILES
$table | string | Table name |
$str | string | Field list to add. |
$specificTypesList='' | string | List of specific types to add the field list to. (If empty, all type entries are affected) |
$beforeList='' | string | Insert fields before one of this fields (commalist). Example: "keywords,--palette--;;4,description". Palettes must be passed like in the example no matter how the palette definition looks like in TCA. |
Returns: | void |
Add tablename to default list of allowed tables on pages.
Will add the $table to the list of tables allowed by default on pages as setup by $PAGES_TYPES['default']['allowedTables']
FOR USE IN ext_tables.php FILES
$table | string | Table name |
Returns: | void |
Adds a module (main or sub) to the backend interface
FOR USE IN ext_tables.php FILES
$main | string | $main is the main module key, $sub is the submodule key. So $main would be an index in the $TBE_MODULES array and $sub could be an element in the lists there. |
$sub='' | string | $sub is the submodule key. If $sub is not set a blank $main module is created. |
$position='' | string | $position can be used to set the position of the $sub module within the list of existing submodules for the main module. $position has this syntax: [cmd]:[submodule-key]. cmd can be "after", "before" or "top" (or blank which is default). If "after"/"before" then submodule will be inserted after/before the existing submodule with [submodule-key] if found. If not found, the bottom of list. If "top" the module is inserted in the top of the submodule list. |
$path='' | string | $path is the absolute path to the module. If this value is defined the path is added as an entry in $TBE_MODULES['_PATHS'][ main_sub ]=$path; and thereby tells the backend where the newly added modules is found in the system. |
Returns: | void |
Adds a "Function menu module" ('third level module') to an existing function menu for some other backend module
The arguments values are generally determined by which function menu this is supposed to interact with
See Inside TYPO3 for information on how to use this function.
FOR USE IN ext_tables.php FILES
$modname | string | Module name |
$className | string | Class name |
$classPath | string | Class path |
$title | string | Title of module |
$MM_key='function' | string | Menu array key - default is "function" |
Returns: | void | |
@see t3lib_SCbase::mergeExternalItems() |
Adds $content to the default Page TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultPageTSconfig']
Prefixed with a [GLOBAL] line
FOR USE IN ext_tables.php/ext_locallang.php FILES
$content | string | Page TSconfig content |
Returns: | void |
Adds $content to the default User TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultUserTSconfig']
Prefixed with a [GLOBAL] line
FOR USE IN ext_tables.php/ext_locallang.php FILES
$content | string | User TSconfig content |
Returns: | void |
Adds a reference to a locallang file with TCA_DESCR labels
FOR USE IN ext_tables.php FILES
eg.
t3lib_extMgm::addLLrefForTCAdescr('pages','EXT:lang/locallang_csh_pages.php');
for the pages table or
t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_layout','EXT:cms/locallang_csh_weblayout.php');
for the Web > Page module.
$tca_descr_key | string | Description key. Typically a database table (like "pages") but for applications can be other strings, but prefixed with "_MOD_") |
$file_ref | string | File reference to locallang file, eg. "EXT:lang/locallang_csh_pages.php" |
Returns: | void |
Adds a service to the global services array
$extKey | string | Extension key |
$serviceType | string | Service type |
$serviceKey | string | Service key |
$info | array | Service description array |
Returns: | void | |
@author René Fritz <r.fritz@colorcube.de> |
Find the available service with highest priority
$serviceType | string | Service type |
$serviceSubType='' | string | Service sub type |
$excludeServiceKeys='' | string | Service key that should be excluded in the search for a service |
Returns: | mixed | Service info array if a service was found, FLASE otherwise |
@author René Fritz <r.fritz@colorcube.de> |
Deactivate a service
$serviceType | string | Service type |
$serviceKey | string | Service key |
Returns: | void | |
@author René Fritz <r.fritz@colorcube.de> |
Adds an entry to the list of plugins in content elements of type "Insert plugin"
Takes the $itemArray (label,value[,icon]) and adds to the items-array
of $TCA[tt_content] elements with CType "listtype" (or another field if
$type points to another fieldname)
If the value (array pos. 1) is already found in that items-array, the
entry is substituted, otherwise the input array is added to the bottom.
Use this function to add a frontend plugin to this list of plugin-types
- or more generally use this function to add an entry to any
selectorbox/radio-button set in the TCEFORMS
FOR USE IN ext_tables.php FILES
$itemArray | array | Item Array |
$type='list_type' | string | Type (eg. "list_type") - basically a field from "tt_content" table |
Returns: | void |
Adds an entry to the "ds" array of the tt_content field "pi_flexform".
This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin.
$piKeyToMatch | string | The same value as the key for the plugin |
$value | string | Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly. |
Returns: | void | |
@see addPlugin() |
Adds the $table tablename to the list of tables allowed to be includes by content element type "Insert records"
By using $content_table and $content_field you can also use the function for other tables.
FOR USE IN ext_tables.php FILES
$table | string | Table name to allow for "insert record" |
$content_table='tt_content' | string | Table name TO WHICH the $table name is applied. See $content_field as well. |
$content_field='records' | string | Field name in the database $content_table in which $table is allowed to be added as a reference ("Insert Record") |
Returns: | void |
Add PlugIn to Static Template #43
When adding a frontend plugin you will have to add both an entry to the
TCA definition of tt_content table AND to the TypoScript template which
must initiate the rendering.
Since the static template with uid 43 is the "content.default" and
practically always used for rendering the content elements it's very
useful to have this function automatically adding the necessary
TypoScript for calling your plugin.
$type determines the type of frontend plugin:
"list_type" (default) - the good old "Insert plugin" entry
"menu_type" - a "Menu/Sitemap" entry
"splash_layout" - a "Textbox" entry
"CType" - a new content element type
"header_layout" - an additional header type (added to the selection of layout1-5)
"includeLib" - just includes the library for manual use somewhere in TypoScript.
(Remember that your $type definition should correspond to the
column/items array in $TCA[tt_content] where you added the selector
item for the element! See addPlugin() function)
FOR USE IN ext_locallang.php FILES
$key | string | $key is the extension key |
$classFile='' | string | $classFile is the PHP-class filename relative to the extension root directory. If set to blank a default value is chosen according to convensions. |
$prefix='' | string | $prefix is used as a - yes, suffix - of the class name (fx. "_pi1") |
$type='list_type' | string | $type, see description above |
$cached=0 | boolean | If $cached is set as USER content object (cObject) is created - otherwise a USER_INT object is created. |
Returns: | void |
Call this method to add an entry in the static template list found in sys_templates
"static template files" are the modern equalent (provided from extensions) to the traditional records in "static_templates"
FOR USE IN ext_locallang.php FILES
$extKey | string | $extKey is of course the extension key |
$path | string | $path is the path where the template files (fixed names) include_static.txt (integer list of uids from the table "static_templates"), constants.txt, setup.txt and editorcfg.txt is found (relative to extPath, eg. 'static/') |
$title | string | $title is the title in the selector box. |
Returns: | void | |
@see addTypoScript() |
Adds $content to the default TypoScript setup code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_setup']
Prefixed with a [GLOBAL] line
FOR USE IN ext_locallang.php FILES
$content | string | TypoScript Setup string |
Returns: | void |
Adds $content to the default TypoScript constants code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_constants']
Prefixed with a [GLOBAL] line
FOR USE IN ext_locallang.php FILES
$content | string | TypoScript Constants string |
Returns: | void |
Adds
$content to the default TypoScript code for either setup, constants or
editorcfg as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_*']
(Basically this function can do the same as addTypoScriptSetup and
addTypoScriptConstants - just with a little more hazzle, but also with
some more options!)
FOR USE IN ext_locallang.php FILES
$key | string | $key is the extension key (informative only). |
$type | string | $type is either "setup", "constants" or "editorcfg" and obviously determines which kind of TypoScript code we are adding. |
$content | string | $content is the TS content, prefixed with a [GLOBAL] line and a comment-header. |
$afterStaticUid=0 | string | $afterStaticUid is either an integer pointing to a uid of a static_template or a string pointing to the "key" of a static_file template ([reduced extension_key]/[local path]). The points is that the TypoScript you add is included only IF that static template is included (and in that case, right after). So effectively the TypoScript you set can specifically overrule settings from those static templates. |
Returns: | void |
Loading extensions configured in $TYPO3_CONF_VARS['EXT']['extList']
CACHING ON: ($TYPO3_CONF_VARS['EXT']['extCache'] = 1 or 2)
If
caching is enabled (and possible), the output will be
$extensions['_CACHEFILE'] set to the cacheFilePrefix. Subsequently the
cache files must be included then since those will eventually set up
the extensions.
If cachefiles are not found they will be generated
CACHING OFF: ($TYPO3_CONF_VARS['EXT']['extCache'] = 0)
The returned value will be an array where each key is an extension key
and the value is an array with filepaths for the extension.
This array will later be set in the global var $TYPO3_LOADED_EXT
Usages of this function can be see in config_default.php
Extensions are always detected in the order local - global - system.
Returns: | array | Extension Array |
@internal |
Returns the section headers for the compiled cache-files.
$key | string | $key is the extension key |
$file | string | $file is the filename (only informative for comment) |
Returns: | string | |
@internal |
Returns true if both the localconf and tables cache file exists (with $cacheFilePrefix)
$cacheFilePrefix | string | Prefix of the cache file to check |
Returns: | boolean | |
@internal |
Returns true if the "localconf.php" file in "typo3conf/" is writable
Returns: | boolean | |
@internal |
Returns an error string if typo3conf/ or cache-files with $cacheFilePrefix are NOT writable
Returns false if no problem.
$cacheFilePrefix | string | Prefix of the cache file to check |
Returns: | string | |
@internal |
Returns an array with the two cache-files (0=>localconf, 1=>tables) from typo3conf/ if they (both) exist. Otherwise false.
Evaluation relies on $TYPO3_LOADED_EXT['_CACHEFILE']
Returns: | array | |
@internal |
Compiles/Creates the two cache-files in typo3conf/ based on $cacheFilePrefix
Returns a array with the key "_CACHEFILE" set to the $cacheFilePrefix value
$extensions | array | Extension information array |
$cacheFilePrefix | string | Prefix for the cache files |
Returns: | array | |
@internal |
Parent class for 'Extension Objects' in backend modules.
Used for 'submodules' to other modules. Also called 'Function menu
modules' in t3lib_extMgm. And now its even called 'Extension Objects'.
Or 'Module functions'. Wish we had just one name. Or a name at
all...(?) Thank God its not so advanced when it works...
In other words this class is used for backend modules which is not true
backend modules appearing in the menu but rather adds themselves as a
new entry in the function menu which typically exists for a backend
module (like Web>Functions, Web>Info or Tools etc...)
The magic that binds this together is stored in the global variable
$TBE_MODULES_EXT where extensions wanting to connect a module based on
this class to an existing backend module store configuration which
consists of the classname, script-path and a label (title/name)
For more information about this, please see the large example comment
for the class t3lib_SCbase. This will show the principle of a 'level-1'
connection.
The more advanced example - having two layers as it is done by the
'func_wizards' extension with the 'web_info' module - can be seen in
the comment above.
Filesize: | 10.9 K |
Func/Classes: | 7 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_SCbase,tx_funcwizards_webfunc::init(), tx_funcwizards_webfunc, tx_wizardsortpages_webfunc_2 |
Parent class for 'Extension Objects' in backend modules.
Used for 'submodules' to other modules. Also called 'Function menu
modules' in t3lib_extMgm. And now its even called 'Extension Objects'.
Or 'Module functions'. Wish we had just one name. Or a name at
all...(?) Thank God its not so advanced when it works...
In other words this class is used for backend modules which is not true
backend modules appearing in the menu but rather adds themselves as a
new entry in the function menu which typically exists for a backend
module (like Web>Functions, Web>Info or Tools etc...)
The magic that binds this together is stored in the global variable
$TBE_MODULES_EXT where extensions wanting to connect a module based on
this class to an existing backend module store configuration which
consists of the classname, script-path and a label (title/name)
For more information about this, please see the large example comment
for the class t3lib_SCbase. This will show the principle of a 'level-1'
connection.
The more advanced example - having two layers as it is done by the
'func_wizards' extension with the 'web_info' module - can be seen in
the comment above.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_SCbase,tx_funcwizards_webfunc::init(), tx_funcwizards_webfunc, tx_wizardsortpages_webfunc_2 |
Initialize the object
&$pObj | object | A reference to the parent (calling) object (which is probably an instance of an extension class to t3lib_SCbase) |
$conf | array | The configuration set for this module - from global array TBE_MODULES_EXT |
Returns: | void | |
@see t3lib_SCbase::checkExtObj() |
If $this->function_key is set (which means there are two levels of object connectivity) then $this->extClassConf is loaded with the TBE_MODULES_EXT configuration for that sub-sub-module
Returns: | void | |
@see $function_key, tx_funcwizards_webfunc::init() |
Including any locallang file configured and merging its content over the current global LOCAL_LANG array (which is EXPECTED to exist!!!)
Returns: | void |
Same as t3lib_SCbase::checkExtObj()
Returns: | void | |
@see t3lib_SCbase::checkExtObj() |
Calls the main function inside ANOTHER sub-submodule which might exist.
Returns: | void |
Dummy function - but is used to set up additional menu items for this submodule.
For an example see the extension 'cms' where the 'web_info' submodule
is defined in cms/web_info/class.tx_cms_webinfo.php,
tx_cms_webinfo_page::modMenu()
Returns: | array | A MOD_MENU array which will be merged together with the one from the parent object |
@see init(), tx_cms_webinfo_page::modMenu() |
Extension class for the t3lib_treeView class, specially made for browsing folders in the File module
Filesize: | 10.3 K |
Func/Classes: | 10 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @coauthor René Fritz <r.fritz@colorcube.de> @package TYPO3 @subpackage t3lib @see class t3lib_treeView |
Extension class for the t3lib_treeView class, specially made for browsing folders in the File module
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@coauthor René Fritz <r.fritz@colorcube.de> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see class t3lib_treeView |
Wrapping the folder icon
$icon | string | The image tag for the icon |
$row | array | The row for the current element |
Returns: | string | The processed icon input value. |
Returns the id from the record - for folders, this is an md5 hash.
$v | array | Record array |
Returns: | integer | The "uid" field value. |
Returns jump-url parameter value.
$v | array | The record array. |
Returns: | string | The jump-url parameter. |
Returns the title for the input record. If blank, a "no title" labele (localized) will be returned.
'_title' is used for setting an alternative title for folders.
$row | array | The input row array (where the key "_title" is used for the title) |
$titleLen=30 | integer | Title length (30) |
Returns: | string | The title. |
Will create and return the HTML code for a browsable tree of folders.
Is based on the mounts found in the internal array ->MOUNTS (set in the constructor)
Returns: | string | HTML code for the browsable tree |
Fetches the data for the tree
$files_path | string | Abs file path |
$depth=999 | integer | Max depth (recursivity limit) |
$depthData='' | string | HTML-code prefix for recursive calls. |
Returns: | integer | The count of items on the level |
@see getBrowsableTree() |
Counts the number of directories in a file path.
$files_path | string | File path. |
Returns: | integer |
Get stored tree structure AND updating it if needed according to incoming PM GET var.
Returns: | void |
Formmail class, used by the TYPO3 "cms" extension (default frontend) to send email forms.
Filesize: | 6.8 K |
Func/Classes: | 3 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see tslib_fe::sendFormmail(), t3lib/formmail.php |
Formmail class, used by the TYPO3 "cms" extension (default frontend) to send email forms.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see tslib_fe::sendFormmail(), t3lib/formmail.php |
Start function
This class is able to generate a mail in formmail-style from the data in $V
Fields:
[recipient]: email-adress of the one to receive the mail. If array, then all values are expected to be recipients
[attachment]: ....
[subject]: The subject of the mail
[from_email]: Sender email. If not set, [email] is used
[from_name]: Sender name. If not set, [name] is used
[replyto_email]: Reply-to email. If not set [from_email] is used
[replyto_name]: Reply-to name. If not set [from_name] is used
[organisation]: Organisation (header)
[priority]: Priority, 1-5, default 3
[html_enabled]: If mail is sent as html
[quoted_printable]: if set, quoted-printable will be used instead of base 64
$V | array | Contains values for the field names listed above (with slashes removed if from POSt input) |
$base64=1 | boolean | Whether to base64 encode the mail content |
Returns: | void |
Adds an attachment to the mail
$file | string | The absolute path to the file to add as attachment |
$filename | string | The files original filename (not necessarily the same as the current since this could be uploaded files...) |
Returns: | boolean | True if the file existed and was added. |
Icon generation, backend
This library has functions that returns - and if necessary creates - the icon for an element in TYPO3
Expects global vars:
- $BACK_PATH
- PATH_typo3
- $TCA, $PAGES_TYPES
Notes:
These functions are strongly related to the interface of TYPO3.
The class is included in eg. init.php
ALL functions called without making a class instance, eg. "t3lib_iconWorks::getIconImage()"
Filesize: | 19.9 K |
Func/Classes: | 8 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Icon generation, backend
This library has functions that returns - and if necessary creates - the icon for an element in TYPO3
Expects global vars:
- $BACK_PATH
- PATH_typo3
- $TCA, $PAGES_TYPES
Notes:
These functions are strongly related to the interface of TYPO3.
The class is included in eg. init.php
ALL functions called without making a class instance, eg. "t3lib_iconWorks::getIconImage()"
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns an icon image tag, 18x16 pixels, based on input information.
This function is recommended to use in your backend modules.
$table | string | The table name |
$row=array() | array | The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!) |
$backPath | string | The backpath to the main TYPO3 directory (relative path back to PATH_typo3) |
$params='' | string | Additional attributes for the image tag |
$shaded=FALSE | boolean | If set, the icon will be grayed/shaded |
Returns: | string | <img>-tag |
@see getIcon() |
Creates the icon for input table/row
Returns filename for the image icon, relative to PATH_typo3
$table | string | The table name |
$row=array() | array | The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!) |
$shaded=FALSE | boolean | If set, the icon will be grayed/shaded |
Returns: | string | Icon filename |
@see getIconImage() |
Returns the src=... for the input $src value OR any alternative found in $TBE_STYLES['skinImg']
Used for skinning the TYPO3 backend with an alternative set of icons
$backPath | string | Current backpath to PATH_typo3 folder |
$src | string | Icon file name relative to PATH_typo3 folder |
$wHattribs='' | string | Default width/height, defined like 'width="12" height="14"' |
$outputMode=0 | integer | Mode: 0 (zero) is default and returns src/width/height. 1 returns value of src+backpath, 2 returns value of w/h. |
Returns: | string | Returns ' src="[backPath][src]" [wHattribs]' |
@see skinImgFile() |
Creates the icon file for the function getIcon()
$iconfile | string | Original unprocessed Icon file, relative path to PATH_typo3 |
$mode | string | Mode string, eg. "deleted" or "futuretiming" determining how the icon will look |
$user | integer | The number of the fe_group record uid if applicable |
$protectSection | boolean | Flag determines if the protected-section icon should be applied. |
$absFile | string | Absolute path to file from which to create the icon. |
$iconFileName_stateTagged | string | The filename that this icon should have had, basically [icon base name]_[flags].[extension] - used for part of temporary filename |
Returns: | string | Filename relative to PATH_typo3 |
The necessity of using this function for combining two images if GD is version 2 is that
GD2 cannot manage to combine two indexed-color images without totally spoiling everything.
In class.t3lib_stdgraphic this was solved by combining the images onto a first created true color image
However it has turned out that this method will not work if the indexed png-files contains transparency.
So I had to turn my attention to ImageMagick - my 'enemy of death'.
And so it happend - ImageMagick is now used to combine my two indexed-color images with transparency. And that works.
Of course it works only if ImageMagick is able to create valid
png-images - which you cannot be sure of with older versions (still 5+)
The only drawback is (apparently) that IM creates true-color png's. The
transparency of these will not be shown by MSIE on windows at this time
(although it's straight 0%/100% transparency!) and the file size may be
larger.
For parameters, see PHP function "imagecopyresized()"
&$im | pointer | see PHP function "imagecopyresized()" |
$cpImg | pointer | see PHP function "imagecopyresized()" |
$Xstart | integer | see PHP function "imagecopyresized()" |
$Ystart | integer | see PHP function "imagecopyresized()" |
$cpImgCutX | integer | see PHP function "imagecopyresized()" |
$cpImgCutY | integer | see PHP function "imagecopyresized()" |
$w | integer | see PHP function "imagecopyresized()" |
$h | integer | see PHP function "imagecopyresized()" |
$w | integer | see PHP function "imagecopyresized()" |
$h | integer | see PHP function "imagecopyresized()" |
Returns: | void |
Create new image pointer from input file (either gif/png, in case the wrong format it is converted by t3lib_div::read_png_gif())
$file | string | Absolute filename of the image file from which to start the icon creation. |
Returns: | mixed | If success, image pointer, otherwise "-1" |
@see t3lib_div::read_png_gif |
Write the icon in $im pointer to $path
$im | pointer | Pointer to GDlib image resource |
$path | string | Absolute path to the filename in which to write the icon. |
Returns: | void |
Load database groups (relations)
Used to process the relations created by the TCA element types "group"
and "select" for database records. Manages MM-relations as well.
Filesize: | 12.8 K |
Func/Classes: | 9 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Load database groups (relations)
Used to process the relations created by the TCA element types "group"
and "select" for database records. Manages MM-relations as well.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialization of the class.
$itemlist | string | List of group/select items |
$tablelist | string | Comma list of tables, first table takes priority if no table is set for an entry in the list. |
$MMtable='' | string | Name of a MM table. |
$MMuid=0 | integer | Local UID for MM lookup |
Returns: | void |
Explodes the item list and stores the parts in the internal arrays itemArray and tableArray from MM records.
$itemlist | string | Item list |
Returns: | void |
Reads the record tablename/id into the internal arrays itemArray and tableArray from MM records.
You can call this function after start if you supply no list to start()
$tableName | string | MM Tablename |
$uid | integer | Local UID |
Returns: | void |
Writes the internal itemArray to MM table:
$tableName | string | MM table name |
$uid | integer | Local UID |
$prependTableName=0 | boolean | If set, then table names will always be written. |
Returns: | void |
After initialization you can extract an array of the elements from the object. Use this function for that.
$prependTableName='' | boolean | If set, then table names will ALWAYS be prepended (unless its a _NO_TABLE value) |
Returns: | array | A numeric array. |
Converts id numbers from negative to positive.
$valueArray | array | Array of [table]_[id] pairs. |
$fTable | string | Foreign table (the one used for positive numbers) |
$nfTable | string | NEGative foreign table |
Returns: | array | The array with ID integer values, converted to positive for those where the table name was set but did NOT match the positive foreign table. |
Reads
all records from internal tableArray into the internal ->results
array where keys are table names and for each table, records are stored
with uids as their keys.
If $this->fromTC is set you can save a little memory since only uid,pid and a few other fields are selected.
Returns: | void |
Prepare items from itemArray to be transferred to the TCEforms interface (as a comma list)
Returns: | string | |
@see t3lib_transferdata::renderRecord() |
Load Backend Interface modules
Typically instantiated like this:
$this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
$this->loadModules->load($TBE_MODULES);
Filesize: | 19.0 K |
Func/Classes: | 8 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Load Backend Interface modules
Typically instantiated like this:
$this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
$this->loadModules->load($TBE_MODULES);
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Init.
The outcome of the load() function will be a $this->modules array
populated with the backend module structure available to the BE_USER
Further the global var $LANG will have labels and images for the modules loaded in an internal array.
$modulesArray | array | $modulesArray should be the global var $TBE_MODULES, $BE_USER can optionally be set to an alternative Backend user object than the global var $BE_USER (which is the currently logged in user) |
$BE_USER='' | object | Optional backend user object to use. If not set, the global BE_USER object is used. |
Returns: | void |
If the module name ($name) is a module from an extension (has path in $this->absPathArray) then that path is returned relative to PATH_site
$name | string | Module name |
Returns: | string | If found, the relative path from PATH_site |
Here we check for the module. If not a conf-file is set then it's regarded to be a spacer
Return values:
'notFound': If the module was not found in the path
false: If no access to the module
array(): Configuration array, in case a valid module where access IS granted exists.
$name | string | Module name |
$fullpath | string | Absolute path to module |
Returns: | mixed | See description of function |
Returns true if the internal BE_USER has access to the module $name with $MCONF (based on security level set for that module)
$name | string | Module name |
$MCONF | array | MCONF array (module configuration array) from the modules conf.php file (contains settings about what access level the module has) |
Returns: | boolean | True if access is granted for $this->BE_USER |
Parses the moduleArray ($TBE_MODULES) into a internally useful structure.
Returns an array where the keys are names of the module and the values may be true (only module) or an array (of submodules)
$arr | array | moduleArray ($TBE_MODULES) |
Returns: | array | Output structure with available modules |
The $str is cleaned so that it contains alphanumerical characters only. Modules must only consist of these characters
$str | string | String to clean up |
Returns: | string |
Get relative path for $destDir compared to $baseDir
$baseDir | string | Base directory |
$destDir | string | Destination directory |
Returns: | string | The relative path of destination compared to base. |
Matching TypoScript conditions
Used with the TypoScript parser.
Matches browserinfo, IPnumbers for use with templates
Filesize: | 17.5 K |
Func/Classes: | 8 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_TStemplate::matching(), t3lib_TStemplate::generateConfig() |
Matching TypoScript conditions
Used with the TypoScript parser.
Matches browserinfo, IPnumbers for use with templates
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_TStemplate::matching(), t3lib_TStemplate::generateConfig() |
Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
$string | string | The condition to match against its criterias. |
Returns: | boolean | Returns true or false based on the evaluation. |
@see t3lib_tsparser::parse() | ||
@link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=292&cHash=c6c7d43d2f |
Will evaluate a $value based on an operator: "<", ">" or "=" (default)
$test | string | The value to compare with on the form [operator][number]. Eg. "< 123" |
$value | integer | The number |
Returns: | boolean | If $value is "50" and $test is "< 123" then it will return true. |
Matching two strings against each other, supporting a "*" wildcard in either end of the $needle
$haystack | string | The string in which to find $needle. |
$needle | string | The string to find in $haystack |
Returns: | boolean | Returns true if $needle matches or is found in (according to wildcards) in $haystack. Eg. if $haystack is "Netscape 6.5" and $needle is "Net*" or "Netscape*" then it returns true. |
Returns a code for a browsing device based on the input useragent string
$useragent | string | User agent string from browser, t3lib_div::getIndpEnv('HTTP_USER_AGENT') |
Returns: | string | A code. See link. |
@link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=296&cHash=a8ae66c7d6 |
Generates an array with abstracted browser information
In the function match() this method is called and the result stored in $this->browserInfoArray
$useragent | string | The useragent string, t3lib_div::getIndpEnv('HTTP_USER_AGENT') |
Returns: | array | Contains keys "browser", "version", "system" |
@see match() |
Return global variable where the input string $var defines array keys separated by "|"
$var | string | Global var key, eg. "HTTP_GET_VAR" or "HTTP_GET_VARS|id" to get the id GET parameter back. |
$inArr='' | array | Alternative array than $GLOBAL to get variables from. |
Returns: | mixed | Whatever value. If none, then blank string. |
Returns GP / ENV / TSFE vars
$var | string | Identifier |
Returns: | mixed | The value of the variable pointed to. |
@link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=311&cHash=487cbd5cdf |
Page functions, a lot of sql/pages-related functions
Mainly used in the frontend but also in some cases in the backend.
It's important to set the right $where_hid_del in the object so that the functions operate properly
Filesize: | 25 K |
Func/Classes: | 19 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see tslib_fe::fetch_the_id() |
Page functions, a lot of sql/pages-related functions
Mainly used in the frontend but also in some cases in the backend.
It's important to set the right $where_hid_del in the object so that the functions operate properly
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see tslib_fe::fetch_the_id() |
init() MUST be run directly after creating a new template-object
This sets the internal variable $this->where_hid_del to the correct
where clause for page records taking deleted/hidden/starttime/endtime
into account
$show_hidden | boolean | If $show_hidden is true, the hidden-field is ignored!! Normally this should be false. Is used for previewing. |
Returns: | void | |
@see tslib_fe::fetch_the_id(), tx_tstemplateanalyzer::initialize_editor() |
Returns the $row for the page with uid = $uid (observing ->where_hid_del)
Any pages_language_overlay will be applied before the result is returned.
If no page is found an empty array is returned.
$uid | integer | The page id to look up. |
Returns: | array | The page row with overlayed localized fields. Empty it no page. |
@see getPage_noCheck() |
Return the $row for the page with uid = $uid WITHOUT checking for ->where_hid_del (start- and endtime or hidden). Only "deleted" is checked!
$uid | integer | The page id to look up |
Returns: | array | The page row with overlayed localized fields. Empty it no page. |
@see getPage() |
Returns the $row of the first web-page in the tree (for the default menu...)
$uid | integer | The page id for which to fetch first subpages (PID) |
Returns: | mixed | If found: The page record (with overlayed localized fields, if any). If NOT found: blank value (not array!) |
@see tslib_fe::fetch_the_id() |
Returns a pagerow for the page with alias $alias
$alias | string | The alias to look up the page uid for. |
Returns: | integer | Returns page uid (integer) if found, otherwise 0 (zero) |
@see tslib_fe::checkAndSetAlias(), tslib_cObj::typoLink() |
Returns the relevant page overlay record fields
$pageInput | mixed | If $pageInput is an integer, it's the pid of the pageOverlay record and thus the page overlay record is returned. If $pageInput is an array, it's a page-record and based on this page record the language record is found and OVERLAYED before the page record is returned. |
$lUid=-1 | integer | Language UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0 |
Returns: | array | Page row which is overlayed with language_overlay record (or the overlay record alone) |
Returns an array with pagerows for subpages with pid=$uid (which is pid here!). This is used for menus.
$uid | integer | The page id for which to fetch subpages (PID) |
$fields='*' | string | List of fields to select. Default is "*" = all |
$sortField='sorting' | string | The field to sort by. Default is "sorting" |
$addWhere='' | string | Optional additional where clauses. Like "AND title like '%blabla%'" for instance. |
Returns: | array | Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlayed localized fields, if any) |
@see tslib_fe::getPageShortcut(), tslib_menu::makeMenu(), tx_wizardcrpages_webfunc_2, tx_wizardsortpages_webfunc_2 |
Will find the page carrying the domain record matching the input domain.
Might exit after sending a redirect-header IF a found domain record instructs to do so.
$domain | string | Domain name to search for. Eg. "www.typo3.com". Typical the HTTP_HOST value. |
$path='' | string | Path for the current script in domain. Eg. "/somedir/subdir". Typ. supplied by t3lib_div::getIndpEnv('SCRIPT_NAME') |
$request_uri='' | string | Request URI: Used to get parameters from if they should be appended. Typ. supplied by t3lib_div::getIndpEnv('REQUEST_URI') |
Returns: | mixed | If found, returns integer with page UID where found. Otherwise blank. Might exit if location-header is sent, see description. |
@see tslib_fe::findDomainRecord() |
Returns array with fields of the pages from here ($uid) and back to the root
NOTICE: This function only takes deleted pages into account! So hidden,
starttime and endtime restricted pages are included no matter what.
Further: If any "recycler" page is found (doktype=255) then it will also block for the rootline)
If you want more fields in the rootline records than default such can
be added by listing them in
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']
$uid | integer | The page uid for which to seek back to the page tree root. |
$MP='' | string | Commalist of MountPoint parameters, eg. "1-2,3-4" etc. Normally this value comes from the GET var, MP |
Returns: | array | Array with page records from the root line as values. The array is ordered with the outer records first and root record in the bottom. The keys are numeric but in reverse order. So if you traverse/sort the array by the numeric keys order you will get the order from root and out. If an error is found (like eternal looping or invalid mountpoint) it will return an empty array. |
@see tslib_fe::getPageAndRootline() |
Creates a "path" string for the input root line array titles.
Used for writing statistics.
$rl | array | A rootline array! |
$len=20 | integer | The max length of each title from the rootline. |
Returns: | string | The path in the form "/page title/This is another pageti.../Another page" |
@see tslib_fe::getConfigArray() |
Returns the URL type for the input page row IF the doktype is 3 and not disabled.
$pagerow | array | The page row to return URL type for |
$disable=0 | boolean | A flag to simply disable any output from here. |
Returns: | string | The URL type from $this->urltypes array. Blank if not found or disabled. |
@see tslib_fe::checkJumpUrl() |
Checks if a record exists and is accessible.
The row is returned if everything's OK.
$table | string | The table name to search |
$uid | integer | The uid to look up in $table |
$checkPage=0 | boolean | If checkPage is set, it's also required that the page on which the record resides is accessible |
Returns: | mixed | Returns array (the record) if OK, otherwise blank/0 (zero) |
Returns record no matter what - except if record is deleted
$table | string | The table name to search |
$uid | integer | The uid to look up in $table |
$fields='*' | string | The fields to select, default is "*" |
Returns: | mixed | Returns array (the record) if found, otherwise blank/0 (zero) |
@see getPage_noCheck() |
Selects records based on matching a field (ei. other than UID) with a value
$theTable | string | The table name to search, eg. "pages" or "tt_content" |
$theField | string | The fieldname to match, eg. "uid" or "alias" |
$theValue | string | The value that fieldname must match, eg. "123" or "frontpage" |
$whereClause='' | string | Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy='' | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy='' | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit='' | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | mixed | Returns array (the record) if found, otherwise blank/0 (zero) |
Returns string value stored for the hash string in the table "cache_hash"
Can be used to retrieved a cached value
Can be used from your frontend plugins if you like. Is also used to
store the parsed TypoScript template structures. You can call it
directly like t3lib_pageSelect::getHash()
$hash | string | The hash-string which was used to store the data value |
$expTime=0 | integer | Allowed expiretime in seconds. Basically a record is selected only if it is not older than this value in seconds. If expTime is not set, the hashed value will never expire. |
Returns: | string | The "content" field of the "cache_hash" table row. |
@see tslib_TStemplate::start(), storeHash() |
Stores a string value in the cache_hash table identified by $hash.
Can be used from your frontend plugins if you like. You can call it directly like t3lib_pageSelect::storeHash()
$hash | string | 32 bit hash string (eg. a md5 hash of a serialized array identifying the data being stored) |
$data | string | The data string. If you want to store an array, then just serialize it first. |
$ident | string | $ident is just a textual identification in order to inform about the content! May be 20 characters long. |
Returns: | void | |
@see tslib_TStemplate::start(), getHash() |
Returns the "AND NOT deleted" clause for the tablename given IF $TCA configuration points to such a field.
$table | string | Tablename |
Returns: | string | |
@see enableFields() |
Returns
a part of a WHERE clause which will filter out records with start/end
times or hidden/fe_groups fields set to values that should de-select
them according to the current time, preview settings or user login.
Definitely a frontend function.
Is using the $TCA arrays "ctrl" part where the key "enablefields"
determines for each table which of these features applies to that table.
$table | string | Table name found in the $TCA array |
$show_hidden=-1 | integer | If $show_hidden is set (0/1), any hidden-fields in records are ignored. NOTICE: If you call this function, consider what to do with the show_hidden parameter. Maybe it should be set? See tslib_cObj->enableFields where it's implemented correctly. |
$ignore_array=array() | array | Array you can pass where keys can be "disabled", "starttime", "endtime", "fe_group" (keys from "enablefields" in TCA) and if set they will make sure that part of the clause is not added. Thus disables the specific part of the clause. For previewing etc. |
Returns: | string | The clause starting like " AND ...=... AND ...=..." |
@see tslib_cObj::enableFields(), deleteClause() |
Class for generating a page tree.
Filesize: | 4.4 K |
Func/Classes: | 5 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @coauthor René Fritz <r.fritz@colorcube.de> @see t3lib_treeView, t3lib_browseTree @package TYPO3 @subpackage t3lib |
Class for generating a page tree.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@coauthor René Fritz <r.fritz@colorcube.de> | ||
@see t3lib_treeView, t3lib_browseTree | ||
@package TYPO3 | ||
@subpackage t3lib |
Init function
REMEMBER to feed a $clause which will filter out non-readable pages!
$clause='' | string | Part of where query which will filter out non-readable pages. |
Returns: | void |
Returns true/false if the next level for $id should be expanded - and all levels should, so we always return 1.
$id | integer | ID (uid) to test for (see extending classes where this is checked againts session data) |
Returns: | boolean |
Generate the plus/minus icon for the browsable tree.
In this case, there is no plus-minus icon displayed.
$row | array | record for the entry |
$a | integer | The current entry number |
$c | integer | The total number of entries. If equal to $a, a 'bottom' element is returned. |
$nextCount | integer | The number of sub-elements to the current element. |
$exp | boolean | The element was expanded to render subelements if this flag is set. |
Returns: | string | Image tag with the plus/minus icon. |
@see t3lib_treeView::PMicon() |
Get stored tree structure AND updating it if needed according to incoming PM GET var.
- Here we just set it to nothing since we want to just render the tree, nothing more.
Returns: | void |
Functions for parsing HTML.
You are encouraged to use this class in your own applications
Filesize: | 48 K |
Func/Classes: | 27 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Functions for parsing HTML.
You are encouraged to use this class in your own applications
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns the first subpart encapsulated in the marker, $marker (possibly present in $content as a HTML comment)
$content | string | Content with subpart wrapped in fx. "###CONTENT_PART###" inside. |
$marker | string | Marker string, eg. "###CONTENT_PART###" |
Returns: | string |
Substitutes a subpart in $content with the content of $subpartContent.
$content | string | Content with subpart wrapped in fx. "###CONTENT_PART###" inside. |
$marker | string | Marker string, eg. "###CONTENT_PART###" |
$subpartContent | array | If $subpartContent happens to be an array, it's [0] and [1] elements are wrapped around the content of the subpart (fetched by getSubpart()) |
$recursive=1 | boolean | If $recursive is set, the function calls itself with the content set to the remaining part of the content after the second marker. This means that proceding subparts are ALSO substituted! |
$keepMarker=0 | boolean | If set, the marker around the subpart is not removed, but kept in the output |
Returns: | string | Processed input content |
Returns an array with the $content divided by tag-blocks specified with the list of tags, $tag
Even numbers in the array are outside the blocks, Odd numbers are block-content.
Use ->getAllParts() and ->removeFirstAndLastTag() to process the content if needed.
$tag | string | List of tags, comma separated. |
$content | string | HTML-content |
$eliminateExtraEndTags=0 | boolean | If set, excessive end tags are ignored - you should probably set this in most cases. |
Returns: | array | Even numbers in the array are outside the blocks, Odd numbers are block-content. |
@see splitTags(), getAllParts(), removeFirstAndLastTag() |
Returns an array with the $content divided by tag-blocks specified with the list of tags, $tag
Even numbers in the array are outside the blocks, Odd numbers are block-content.
Use ->getAllParts() and ->removeFirstAndLastTag() to process the content if needed.
$tag | string | List of tags |
$content | string | HTML-content |
Returns: | array | Even numbers in the array are outside the blocks, Odd numbers are block-content. |
@see splitIntoBlock(), getAllParts(), removeFirstAndLastTag() |
Returns an array with either tag or non-tag content of the result from ->splitIntoBlock()/->splitTags()
$parts | array | Parts generated by ->splitIntoBlock() or >splitTags() |
$tag_parts=1 | boolean | Whether to return the tag-parts (default,true) or what was outside the tags. |
$include_tag=1 | boolean | Whether to include the tags in the tag-parts (most useful for input made by ->splitIntoBlock()) |
Returns: | array | Tag-parts/Non-tag-parts depending on input argument settings |
@see splitIntoBlock(), splitTags() |
Removes the first and last tag in the string
Anything before and after the first and last tags respectively is also removed
$str | string | String to process |
Returns: | string |
Returns the first tag in $str
Actually everything from the begining of the $str is returned, so you better make sure the tag is the first thing...
$str | string | HTML string with tags |
Returns: | string |
Returns the NAME of the first tag in $str
$str | string | HTML tag (The element name MUST be separated from the attributes by a space character! Just *whitespace* will not do) |
$preserveCase=FALSE | boolean | If set, then the tag is NOT converted to uppercase by case is preserved. |
Returns: | string | Tag name in upper case |
@see getFirstTag() |
Checks whether block/solo tags are found in the correct amounts in HTML content
Block tags are tags which are required to have an equal amount of start and end tags, eg. "<table>...</table>"
Solo tags are tags which are required to have ONLY start tags (possibly with an XHTML ending like ".../>")
NOTICE: Correct XHTML might actually fail since "<br></br>"
is allowed as well as "<br/>". However only the LATTER is
accepted by this function (with "br" in the "solo-tag" list), the first
example will result in a warning.
NOTICE: Correct XHTML might actually fail since "<p/>" is allowed
as well as "<p></p>". However only the LATTER is accepted
by this function (with "p" in the "block-tag" list), the first example
will result in an ERROR!
NOTICE: Correct HTML version "something" allows eg. <p> and
<li> to be NON-ended (implicitly ended by other tags). However
this is NOT accepted by this function (with "p" and "li" in the
block-tag list) and it will result in an ERROR!
$content | string | HTML content to analyze |
$blockTags='a,b,blockquote,body,div,em,font,form,h1,h2,h3,h4,h5,h6,i,li,map,ol,option,p,pre,select,span,strong,table,td,textarea,tr,u,ul' | string | Tag names for block tags (eg. table or div or p) in lowercase, commalist (eg. "table,div,p") |
$soloTags='br,hr,img,input,area' | string | Tag names for solo tags (eg. img, br or input) in lowercase, commalist ("img,br,input") |
Returns: | array | Analyse data. |
Function that can clean up HTML content according to configuration given in the $tags array.
Initializing the $tags array to allow a list of tags (in this case
<B>,<I>,<U> and <A>), set it like this: $tags =
array_flip(explode(',','b,a,i,u'))
If the value of the $tags[$tagname] entry is an array, advanced processing of the tags is initialized. These are the options:
$tags[$tagname] = Array(
'overrideAttribs' => '' If set, this string is preset as the attributes of the tag
'allowedAttribs' => '0' (zero) = no attributes allowed, '[commalist
of attributes]' = only allowed attributes. If blank, all attributes are
allowed.
'fixAttrib' => Array(
'[attribute name]' => Array (
'default' => If no attribute exists by this name, this value is set as default value (if this value is not blank)
'always' => Boolean. If set, the attribute is always processed. Normally an attribute is processed only if it exists
'trim,intval,lower,upper' => All booleans. If any of these keys are
set, the value is passed through the respective PHP-functions.
'range' => Array ('[low limit]','[high limit, optional]') Setting integer range.
'list' => Array ('[value1/default]','[value2]','[value3]') Attribute
must be in this list. If not, the value is set to the first element.
'removeIfFalse' => Boolean/'blank'. If set, then the attribute is
removed if it is 'false'. If this value is set to 'blank' then the
value must be a blank string (that means a 'zero' value will not be
removed)
'removeIfEquals' => [value] If the attribute value matches the value set here, then it is removed.
'casesensitiveComp' => 1 If set, then the removeIfEquals and list comparisons will be case sensitive. Otherwise not.
)
),
'protect' => '', Boolean. If set, the tag <> is converted to < and >
'remap' => '', String. If set, the tagname is remapped to this tagname
'rmTagIfNoAttrib' => '', Boolean. If set, then the tag is removed if no attributes happend to be there.
'nesting' => '', Boolean/'global'. If set true, then this tag must
have starting and ending tags in the correct order. Any tags not in
this order will be discarded. Thus
'</B><B><I></B></I></B>' will be
converted to '<B><I></B></I>'. Is the value
'global' then true nesting in relation to other tags marked for
'global' nesting control is preserved. This means that if <B> and
<I> are set for global nesting then this string
'</B><B><I></B></I></B>' is
converted to '<B></B>'
)
$content | string | $content; is the HTML-content being processed. This is also the result being returned. |
$tags=array() | array | $tags; is an array where each key is a tagname in lowercase. Only tags present as keys in this array are preserved. The value of the key can be an array with a vast number of options to configure. |
$keepAll=0 | string | $keepAll; boolean/'protect', if set, then all tags are kept regardless of tags present as keys in $tags-array. If 'protect' then the preserved tags have their <> converted to < and > |
$hSC=0 | integer | $hSC; Values -1,0,1,2: Set to zero= disabled, set to 1 then the content BETWEEN tags is htmlspecialchar()'ed, set to -1 its the opposite and set to 2 the content will be HSC'ed BUT with preservation for real entities (eg. "&" or "ê") |
$addConfig=array() | array | Configuration array send along as $conf to the internal functions ->processContent() and ->processTag() |
Returns: | string | Processed HTML content |
Returns an array with all attributes as keys. Attributes are only lowercase a-z
If a attribute is empty (shorthand), then the value for the key is empty. You can check if it existed with isset()
$tag | string | Tag: $tag is either a whole tag (eg '<TAG OPTION ATTRIB=VALUE>') or the parameterlist (ex ' OPTION ATTRIB=VALUE>') |
$deHSC=0 | boolean | If set, the attribute values are de-htmlspecialchar'ed. Should actually always be set! |
Returns: | array | array(Tag attributes,Attribute meta-data) |
Returns an array with the 'components' from an attribute list. The result is normally analyzed by get_tag_attributes
Removes tag-name if found
$tag | string | The tag or attributes |
Returns: | array | |
@see t3lib_div::split_tag_attributes() |
Converts htmlspecialchars forth ($dir=1) AND back ($dir=-1)
$value | string | Input value |
$dir | integer | Direction: forth ($dir=1, dir=2 for preserving entities) AND back ($dir=-1) |
Returns: | string | Output value |
Prefixes the relative paths of hrefs/src/action in the tags [td,table,body,img,input,form,link,script,a] in the $content with the $main_prefix or and alternative given by $alternatives
$main_prefix | string | Prefix string |
$content | string | HTML content |
$alternatives=array() | array | Array with alternative prefixes for certain of the tags. key=>value pairs where the keys are the tag element names in uppercase |
Returns: | string | Processed HTML content |
Internal sub-function for ->prefixResourcePath()
$prefix | string | Prefix string |
$srcVal | string | Relative path/URL |
Returns: | string | Output path, prefixed if no scheme in input string |
Cleans up the input $value for fonttags.
If keepFace,-Size and -Color is set then font-tags with an allowed property is kept. Else deleted.
$value | string | HTML content with font-tags inside to clean up. |
$keepFace=0 | boolean | If set, keep "face" attribute |
$keepSize=0 | boolean | If set, keep "size" attribute |
$keepColor=0 | boolean | If set, keep "color" attribute |
Returns: | string | Processed HTML content |
This is used to map certain tag-names into other names.
$value | string | HTML content |
$tags=array() | array | Array with tag key=>value pairs where key is from-tag and value is to-tag |
$ltChar='<' | string | Alternative less-than char to search for (search regex string) |
$ltChar2='<' | string | Alternative less-than char to replace with (replace regex string) |
Returns: | string | Processed HTML content |
This converts htmlspecialchar()'ed tags (from $tagList) back to real tags. Eg. '<strong>' would be converted back to '<strong>' if found in $tagList
$content | string | HTML content |
$tagList='' | string | Tag list, separated by comma. Lowercase! |
Returns: | string | Processed HTML content |
Strips tags except the tags in the list, $tagList
OBSOLETE - use PHP function strip_tags()
$value | string | Value to process |
$tagList | string | List of tags |
Returns: | string | Output value |
Internal function for case shifting of a string or whole array
$str | mixed | Input string/array |
$flag | boolean | If $str is a string AND this boolean is true, the string is returned in uppercase |
$cacheKey='' | string | Key string used for internal caching of the results. Could be an MD5 hash of the serialized version of the input $str if that is an array. |
Returns: | string | Output string, processed |
Compiling an array with tag attributes into a string
$tagAttrib | array | Tag attributes |
$meta=array() | array | Meta information about these attributes (like if they were quoted) |
$xhtmlClean=0 | boolean | If set, then the attribute names will be set in lower case, value quotes in double-quotes and the value will be htmlspecialchar()'ed |
Returns: | string | Imploded attributes, eg: 'attribute="value" attrib2="value2"' |
Get tag attributes, the classic version (which had some limitations?)
$tag | string | The tag |
$deHSC=0 | boolean | De-htmlspecialchar flag. |
Returns: | array |
Converts TSconfig into an array for the HTMLcleaner function.
$TSconfig | array | TSconfig for HTMLcleaner |
$keepTags=array() | array | Array of tags to keep (?) |
Returns: | array |
Tries to convert the content to be XHTML compliant and other stuff like that.
STILL EXPERIMENTAL. See comments below.
What it does NOT do (yet) according to XHTML specs.:
- Wellformedness: Nesting is NOT checked
- name/id attribute issue is not observed at this point.
- Certain nesting of elements not allowed. Most interesting, <PRE> cannot contain img, big,small,sub,sup ...
- Wrapping scripts and style element contents in CDATA - or alternatively they should have entitites converted.
- Setting charsets may put some special requirements on both XML declaration/ meta-http-equiv. (C.9)
- UTF-8 encoding is in fact expected by XML!!
- stylesheet element and attribute names are NOT converted to lowercase
- ampersands (and entities in general I think) MUST be converted to an
entity reference! (&s;). This may mean further conversion of
non-tag content before output to page. May be related to the charset
issue as a whole.
- Minimized values not allowed: Must do this: selected="selected"
What it does at this point:
- All tags (frame,base,meta,link + img,br,hr,area,input) is ended with "/>" - others?
- Lowercase for elements and attributes
- All attributes in quotes
- Add "alt" attribute to img-tags if it's not there already.
$content | string | Content to clean up |
Returns: | string | Cleaned up content returned. |
Processing all tags themselves
(Some additions by Sacha Vorbeck)
$value | string | Tag to process |
$conf | array | Configuration array passing instructions for processing. If count()==0, function will return value unprocessed. See source code for details |
$endTag | boolean | Is endtag, then set this. |
$protected=0 | boolean | If set, just return value straight away |
Returns: | string | Processed value. |
Processing content between tags for HTML_cleaner
$value | string | The value |
$dir | integer | Direction, either -1 or +1. 0 (zero) means no change to input value. |
$conf | mixed | Not used, ignore. |
Returns: | string | The processed value. |
Class for parsing HTML for the Rich Text Editor. (also called transformations)
Filesize: | 56 K |
Func/Classes: | 28 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Class for parsing HTML for the Rich Text Editor. (also called transformations)
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialize, setting element reference and record PID
$elRef='' | string | Element reference, eg "tt_content:bodytext" |
$recPid=0 | integer | PID of the record (page id) |
Returns: | void |
Setting
the ->relPath and ->relBackPath to proper values so absolute
references to links and images can be converted to relative dittos.
This is used when editing files with the RTE
$path | string | The relative path from PATH_site to the place where the file being edited is. Eg. "fileadmin/static". |
Returns: | void | There is no output, it is set in internal variables. With the above example of "fileadmin/static" as input this will yield ->relPath to be "fileadmin/static/" and ->relBackPath to be "../../" |
Evaluate the environment for editing a staticFileEdit file.
Called for almost all fields being saved in the database. Is called
without an instance of the object: t3lib_parsehtml_proc::evalWriteFile()
$pArr | array | Parameters for the current field as found in types-config |
$currentRecord | array | Current record we are editing. |
Returns: | mixed | On success an array with various information is returned, otherwise a string with an error message |
@see t3lib_TCEmain, t3lib_transferData |
Tranform value for RTE based on specConf in the direction specified by $direction (rte/db)
This is the main function called from tcemain and transfer data classes
$value | string | Input value |
$specConf | array | Special configuration for a field; This is coming from the types-configuration of the field in the TCA. In the types-configuration you can setup features for the field rendering and in particular the RTE takes al its major configuration options from there! |
$direction='rte' | string | Direction of the transformation. Two keywords are allowed; "db" or "rte". If "db" it means the transformation will clean up content coming from the Rich Text Editor and goes into the database. The other direction, "rte", is of course when content is coming from database and must be transformed to fit the RTE. |
$thisConfig=array() | array | Parsed TypoScript content configuring the RTE, probably coming from Page TSconfig. |
Returns: | string | Output value |
@see t3lib_TCEmain::fillInFieldArray(), t3lib_transferData::renderRecord_typesProc() |
Transformation handler: 'ts_images' / direction: "db"
Processing images inserted in the RTE.
This is used when content goes from the RTE to the database.
Images inserted in the RTE has an absolute URL applied to the src attribute. This URL is converted to a relative URL
If it turns out that the URL is from another website than the current
the image is read from that external URL and moved to the local server.
Also "magic" images are processed here.
$value | string | The content from RTE going to Database |
Returns: | string | Processed content |
Transformation handler: 'ts_images' / direction: "rte"
Processing images from database content going into the RTE.
Processing includes converting the src attribute to an absolute URL.
$value | string | Content input |
Returns: | string | Content output |
Transformation handler: 'ts_reglinks' / direction: "db"+"rte" depending on $direction variable.
Converting <A>-tags to/from abs/rel
$value | string | Content input |
$direction | string | Direction of conversion; "rte" (from database to RTE) or "db" (from RTE to database) |
Returns: | string | Content output |
Transformation handler: 'ts_links' / direction: "db"
Converting <A>-tags to <LINK tags>
$value | string | Content input |
Returns: | string | Content output |
@see TS_links_rte() |
Transformation handler: 'ts_links' / direction: "rte"
Converting <LINK tags> to <A>-tags
$value | string | Content input |
Returns: | string | Content output |
@see TS_links_rte() |
Preserve special tags
$value | string | Content input |
Returns: | string | Content output |
Preserve special tags
$value | string | Content input |
Returns: | string | Content output |
Transformation handler: 'ts_transform' + 'css_transform' / direction: "db"
Cleaning (->db) for standard content elements (ts)
$value | string | Content input |
$css=FALSE | boolean | If true, the transformation was "css_transform", otherwise "ts_transform" |
Returns: | string | Content output |
@see TS_transform_rte() |
Transformation handler: 'ts_transform' + 'css_transform' / direction: "rte"
Set (->rte) for standard content elements (ts)
$value | string | Content input |
$css=0 | boolean | If true, the transformation was "css_transform", otherwise "ts_transform" |
Returns: | string | Content output |
@see TS_transform_db() |
Transformation handler: 'ts_strip' / direction: "db"
Removing all non-allowed tags
$value | string | Content input |
Returns: | string | Content output |
Reads the file or url $url and returns the content
$url | string | Filepath/URL to read |
Returns: | string | The content from the resource given as input. |
@see t3lib_div::getURL() |
Function for cleaning content going into the database.
Content is cleaned eg. by removing unallowed HTML and ds-HSC content
It is basically calling HTMLcleaner from the parent class with some
preset configuration specifically set up for cleaning content going
from the RTE into the db
$content | string | Content to clean up |
$tagList='' | string | Comma list of tags to specifically allow. Default comes from getKeepTags and is "" |
Returns: | string | Clean content |
@see getKeepTags() |
Creates
an array of configuration for the HTMLcleaner function based on whether
content go TO or FROM the Rich Text Editor ($direction)
Unless "tagList" is given, the function will cache the configuration
for next time processing goes on. (In this class that is the case only
if we are processing a bulletlist)
$direction='rte' | string | The direction of the content being processed by the output configuration; "db" (content going into the database FROM the rte) or "rte" (content going into the form) |
$tagList='' | string | Comma list of tags to keep (overriding default which is to keep all + take notice of internal configuration) |
Returns: | array | Configuration array |
@see HTMLcleaner_db() |
This
resolves the $value into parts based on
<div></div>-sections and <p>-sections and <br
/>-tags. These are returned as lines separated by chr(10).
This point is to resolve the HTML-code returned from RTE into ordinary lines so it's 'human-readable'
The function ->setDivTags does the opposite.
This function processes content to go into the database.
$value | string | Value to process. |
$count=5 | integer | Recursion brake. Decremented on each recursion down to zero. Default is 5 (which equals the allowed nesting levels of p/div tags). |
$returnArray=FALSE | boolean | If true, an array with the lines is returned, otherwise a string of the processed input value. |
Returns: | string | Processed input value. |
@see setDivTags() |
Converts all lines into <div></div>/<p></p>-sections (unless the line is a div-section already)
For processing of content going FROM database TO RTE.
$value | string | Value to convert |
$dT='p' | string | Tag to wrap with. Either "p" or "div" should it be. Lowercase preferably. |
Returns: | string | Processed value. |
@see divideIntoLines() |
This splits the $value in font-tag chunks.
If there are any <P>/<DIV> sections inside of them, the
font-tag is wrapped AROUND the content INSIDE of the P/DIV sections and
the outer font-tag is removed.
This functions seems to be a good choice for pre-processing content if it has been pasted into the RTE from eg. star-office.
In that case the font-tags are normally on the OUTSIDE of the sections.
This function is used by eg. divideIntoLines() if the procesing option 'internalizeFontTags' is set.
$value | string | Input content |
Returns: | string | Output content |
@see divideIntoLines() |
Returns SiteURL based on thisScript.
Returns: | string | Value of t3lib_div::getIndpEnv('TYPO3_SITE_URL'); |
@see t3lib_div::getIndpEnv() |
Return the storage folder of RTE image files.
Default is $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']
unless something else is configured in the types configuration for the
RTE.
Returns: | string |
Remove all tables from incoming code
The function is trying to to this is some more or less respectfull way.
The approach is to resolve each table cells content and implode it all
by <br /> chars. Thus at least the content is preserved in some
way.
$value | string | Input value |
$breakChar='<br />' | string | Break character to use for linebreaks. |
Returns: | string | Output value |
Default tag mapping for TS
$code | string | Input code to process |
$direction='rte' | string | Direction To databsae (db) or from database to RTE (rte) |
Returns: | string | Processed value |
Finds width and height from attrib-array
If the width and height is found in the style-attribute, use that!
$attribArray | array | Array of attributes from tag in which to search. More specifically the content of the key "style" is used to extract "width:xxx / height:xxx" information |
Returns: | array | Integer w/h in key 0/1. Zero is returned if not found. |
Parse <A>-tag href and return status of email,external,file or page
$url | string | URL to analyse. |
Returns: | array | Information in an array about the URL |
Converting <A>-tags to absolute URLs (+ setting rtekeep attribute)
$value | string | Content input |
$dontSetRTEKEEP=FALSE | boolean | If true, then the "rtekeep" attribute will not be set. |
Returns: | string | Content output |
Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
Used for pages / tt_content element wizards of various kinds.
Filesize: | 19.8 K |
Func/Classes: | 18 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
Used for pages / tt_content element wizards of various kinds.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Creates a "position tree" based on the page tree.
Notice: A class, "localPageTree" must exist and probably it is an
extension class of the t3lib_pageTree class. See "db_new.php" in the
core for an example.
$id | integer | Current page id |
$pageinfo | array | Current page record. |
$perms_clause | string | Page selection permission clause. |
$R_URI | string | Current REQUEST_URI |
Returns: | string | HTML code for the tree. |
Creates the JavaScritp for insert new-record rollover image
$prefix='' | string | Insert record image prefix. |
Returns: | string | <script> section |
Wrap $t_code in bold IF the $dat uid matches $id
$t_code | string | Title string |
$dat | array | Infomation array with record array inside. |
$id | integer | The current id. |
Returns: | string | The title string. |
Creates the onclick event for the insert-icons.
TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module
to be used instead of the normal create new page wizard.
$pid | integer | The pid. |
$newPagePID | integer | New page id. |
Returns: | string | Onclick attribute content |
Get label, htmlspecialchars()'ed
Returns: | string | The localized label for "insert new page here" |
Wrapping page title.
$str | string | Page title. |
$rec | array | Page record (?) |
Returns: | string | Wrapped title. |
Checks if the user has permission to created pages inside of the $pid page.
Uses caching so only one regular lookup is made - hence you can call
the function multiple times without worrying about performance.
$pid | integer | Page id for which to test. |
Returns: | boolean |
Returns module configuration for a pid.
$pid | integer | Page id for which to get the module configuration. |
Returns: | array | The properties of teh module configuration for the page id. |
@see onClickEvent() |
Insert half/quad lines.
$codes | string | keywords for which lines to insert. |
$allBlank=0 | boolean | If true all lines are just blank clear.gifs |
Returns: | string | HTML content. |
Creates HTML for inserting/moving content elements.
$pid | integer | page id onto which to insert content element. |
$moveUid | integer | Move-uid (tt_content element uid?) |
$colPosList | string | List of columns to show |
$showHidden | boolean | If not set, then hidden/starttime/endtime records are filtered out. |
$R_URI | string | Request URI |
Returns: | string | HTML |
Creates the table with the content columns
$lines | array | Array with arrays of lines for each column |
$colPosArray | array | Column position array |
Returns: | string | HTML |
Wrapping the column header
$str | string | Header value |
$vv | string | Column info. |
Returns: | string | |
@see printRecordMap() |
Creates a linked position icon.
$row | array | Element row. |
$vv | string | Column position value. |
$kk | integer | Column key. |
$moveUid | integer | Move uid |
$pid | integer | PID value. |
Returns: | string |
Create on-click event value.
$row | array | The record. |
$vv | string | Column position value. |
$moveUid | integer | Move uid |
$pid | integer | PID value. |
$sys_lang=0 | integer | System language (not used currently) |
Returns: | string |
Wrapping the record header (from getRecordHeader())
$str | string | HTML content |
$row | array | Record array. |
Returns: | string | HTML content |
Create record header (includes teh record icon, record title etc.)
$row | array | Record row. |
Returns: | string | HTML |
Wrapping the title of the record.
$str | string | The title value. |
$row | array | The record row. |
Returns: | string | Wrapped title string. |
Functions used to read email content
The class is still just a bunch of miscellaneous functions used to read content out of emails
Filesize: | 16.9 K |
Func/Classes: | 15 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Functions used to read email content
The class is still just a bunch of miscellaneous functions used to read content out of emails
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns special TYPO3 Message ID (MID) from input TO header (the return address of the sent mail from Dmailer. Used by Dmailer, return mails)
$to | string | email address, return address string |
Returns: | mixed | array with 'mid', 'rtbl' and 'rid' keys are returned. |
@internal |
Returns special TYPO3 Message ID (MID) from input mail content (used by Dmailer, return mails)
$content | string | Mail (header) content |
Returns: | mixed | If "X-Typo3MID" header is found and integrity is OK, then an array with 'mid', 'rtbl' and 'rid' keys are returned. Otherwise void. |
@internal |
Returns the text content of a mail which has previously been parsed by eg. extractMailHeader()
Probably obsolete since the function fullParse() is more advanced and safer to use.
$mailParts | array | Output from extractMailHeader() |
Returns: | string | The content. |
Returns the body part of a raw mail message (including headers)
Probably obsolete since the function fullParse() is more advanced and safer to use.
$content | string | Raw mail content |
Returns: | string | Body of message |
Splits the body of a mail into parts based on the boundary string given.
Obsolete, use fullParse()
$boundary | string | Boundary string used to split the content. |
$content | string | BODY section of a mail |
Returns: | array | Parts of the mail based on this |
Returns Content Type plus more.
Obsolete, use fullParse()
$str | string | "ContentType" string with more |
Returns: | array | parts in key/value pairs |
Analyses the return-mail content for the Dmailer module - used to find what reason there was for rejecting the mail
Used by the Dmailer, but not exclusively.
$c | string | message body/text |
Returns: | array | key/value pairs with analysis result. Eg. "reason", "content", "reason_text", "mailserver" etc. |
Decodes a header-string with the =?....?= syntax including base64/quoted-printable encoding.
$str | string | A string (encoded or not) from a mail header, like sender name etc. |
Returns: | string | The input string, but with the parts in =?....?= decoded. |
Extracts name/email parts from a header field (like 'To:' or 'From:' with name/email mixed up.
$str | string | Value from a header field containing name/email values. |
Returns: | array | Array with the name and email in. Email is validated, otherwise not set. |
Returns the data from the 'content-type' field. That is the boundary, charset and mime-type
$contentTypeStr | string | "Content-type-string" |
Returns: | array | key/value pairs with the result. |
Makes a UNIX-date based on the timestamp in the 'Date' header field.
$dateStr | string | String with a timestamp according to email standards. |
Returns: | integer | The timestamp converted to unix-time in seconds and compensated for GMT/CET ($this->serverGMToffsetMinutes); |
Parsing the GMT offset value from a mail timestamp.
$GMT | string | A string like "+0100" or so. |
Returns: | integer | Minutes to offset the timestamp |
This returns the mail header items in an array with associative keys and the mail body part in another CONTENT field
$content | string | Raw mail content |
$limit=0 | integer | A safety limit that will put a upper length to how many header chars will be processed. Set to zero means that there is no limit. (Uses a simple substr() to limit the amount of mail data to process to avoid run-away) |
Returns: | array | An array where each key/value pair is a header-key/value pair. The mail BODY is returned in the key 'CONTENT' if $limit is not set! |
The extended version of the extractMailHeader() which will also parse all the content body into an array and further process the header fields and decode content etc. Returns every part of the mail ready to go.
$content | string | Raw email input. |
Returns: | array | Multidimensional array with all parts of the message organized nicely. Use t3lib_div::debug() to analyse it visually. |
This class is the base for listing of database records and files in the modules Web>List and File>Filelist
Filesize: | 10.4 K |
Func/Classes: | 8 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see typo3/db_list.php, typo3/file_list.php |
This class is the base for listing of database records and files in the modules Web>List and File>Filelist
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see typo3/db_list.php, typo3/file_list.php |
Returns a table-row with the content from the fields in the input data array.
OBS: $this->fieldArray MUST be set! (represents the list of fields to display)
$h | integer | $h is an integer >=0 and denotes how tall a element is. Set to '0' makes a halv line, -1 = full line, set to 1 makes a 'join' and above makes 'line' |
$icon | string | $icon is the <img>+<a> of the record. If not supplied the first 'join'-icon will be a 'line' instead |
$data | array | $data is the dataarray, record with the fields. Notice: These fields are (currently) NOT htmlspecialchar'ed before being wrapped in <td>-tags |
$tdParams='' | string | $tdParams is insert in the <td>-tags. Must carry a ' ' as first character |
$lMargin='' | integer | OBSOLETE - NOT USED ANYMORE. $lMargin is the leftMargin (integer) |
$altLine='' | string | $altLine is the HTML <img>-tag for an alternative 'gfx/ol/line.gif'-icon (used in the top) |
Returns: | string | HTML content for the table row |
Finishes the list with the "stopper"-gif, adding the HTML code for that item to the internal ->HTMLcode string
Returns: | void |
Creates a forward/reverse button based on the status of ->eCounter, ->firstElementNumber, ->iLimit
$table='' | string | Table name |
Returns: | array | array([boolean], [HTML]) where [boolean] is 1 for reverse element, [HTML] is the table-row code for the element |
Creates the button with link to either forward or reverse
$type | string | Type: "fwd" or "rwd" |
$pointer | integer | Pointer |
$table='' | string | Table name |
Returns: | string |
Returning "listURL" - the script with parameters to which forward/backward requests are sent
Returns: | string |
Parent class for 'ScriptClasses' in backend modules.
See example comment above.
Filesize: | 13.5 K |
Func/Classes: | 10 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_extobjbase |
Parent class for 'ScriptClasses' in backend modules.
See example comment above.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_extobjbase |
Initializes the backend module by setting internal variables, initializing the menu.
Returns: | void | |
@see menuConfig() |
Initializes
the internal MOD_MENU array setting and unsetting items based on
various conditions. It also merges in external menu items from the
global array TBE_MODULES_EXT (see mergeExternalItems())
Then MOD_SETTINGS array is cleaned up (see
t3lib_BEfunc::getModuleData()) so it contains only valid values. It's
also updated with any SET[] values submitted.
Also loads the modTSconfig internal variable.
Returns: | void | |
@see init(), $MOD_MENU, $MOD_SETTINGS, t3lib_BEfunc::getModuleData(), mergeExternalItems() |
Merges menu items from global array $TBE_MODULES_EXT
$modName | string | Module name for which to find value |
$menuKey | string | Menu key, eg. 'function' for the function menu. |
$menuArr | array | The part of a MOD_MENU array to work on. |
Returns: | array | Modified array part. |
@see t3lib_extMgm::insertModuleFunction(), menuConfig() |
Loads $this->extClassConf with the configuration for the CURRENT function of the menu.
If for this array the key 'path' is set then that is expected to be an
absolute path to a file which should be included - so it is set in the
internal array $this->include_once
$MM_key='function' | string | The key to MOD_MENU for which to fetch configuration. 'function' is default since it is first and foremost used to get information per "extension object" (I think that is what its called) |
Returns: | void | |
@see $include_once, init() |
Returns configuration values from the global variable $TBE_MODULES_EXT for the module given.
For example if the module is named "web_info" and the "function" key
($menuKey) of MOD_SETTINGS is "stat" ($value) then you will have the
values of $TBE_MODULES_EXT['webinfo']['MOD_MENU']['function']['stat']
returned.
$modName | string | Module name |
$menuKey | string | Menu key, eg. "function" for the function menu. See $this->MOD_MENU |
$value='' | string | Optionally the value-key to fetch from the array that would otherwise have been returned if this value was not set. Look source... |
Returns: | mixed | The value from the TBE_MODULES_EXT array. |
@see handleExternalFunctionValue() |
Creates
an instance of the class found in $this->extClassConf['name'] in
$this->extObj if any (this should hold three keys, "name", "path"
and "title" if a "Function menu module" tries to connect...)
This value in extClassConf might be set by an extension (in a ext_tables/ext_localconf file) which thus "connects" to a module.
The array $this->extClassConf is set in handleExternalFunctionValue() based on the value of MOD_SETTINGS[function]
(Should be) called from global scope right after inclusion of files from the ->include_once array.
If an instance is created it is initiated with $this passed as value
and $this->extClassConf as second argument. Further the
$this->MOD_SETTING is cleaned up again after calling the init
function.
Returns: | void | |
@see handleExternalFunctionValue(), t3lib_extMgm::insertModuleFunction(), $extObj |
Calls the 'header' function inside the "Function menu module" if present.
A header function might be needed to add JavaScript or other stuff in
the head. This can't be done in the main function because the head is
already written.
example call in the header function:
$this->pObj->doc->JScode = $this->pObj->doc->wrapScriptTags(' ...
Returns: | void |
Calls the 'main' function inside the "Function menu module" if present
Returns: | void |
PHP SQL engine / server
Filesize: | 72 K |
Func/Classes: | 63 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
PHP SQL engine / server
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Dummy function for initializing SQL handler. Create you own in derived classes.
$config | array | Configuration array from handler |
&$pObj | object | Parent object |
Returns: | void |
Reset SQL engine status variables (insert id, affected rows, error status)
Returns: | void |
Processing of update/insert values based on field type.
&$value | [type] | $$value: ... |
$fInfo | [type] | $fInfo: ... |
Returns: | [type] | ... |
Execute an INSERT query
$table | string | Table name |
$fields_values | array | Field values as key=>value pairs. |
Returns: | boolean | TRUE on success and FALSE on failure (error is set internally) |
Execute UPDATE query on table
$table | string | Table name |
$where | string | WHERE clause |
$fields_values | array | Field values as key=>value pairs. |
Returns: | boolean | TRUE on success and FALSE on failure (error is set internally) |
Execute DELETE query
$table | string | Table to delete from |
$where | string | WHERE clause |
Returns: | boolean | TRUE on success and FALSE on failure (error is set internally) |
Execute SELECT query
$select_fields | string | List of fields to select from the table. This is what comes right after "SELECT ...". Required value. |
$from_table | string | Table(s) from which to select. This is what comes right after "FROM ...". Required value. |
$where_clause | string | Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->quoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! |
$groupBy | string | Optional GROUP BY field(s), if none, supply blank string. |
$orderBy | string | Optional ORDER BY field(s), if none, supply blank string. |
$limit | string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Returns: | object | Returns result object, but if errors, returns false |
Performs an SQL query on the "database"
$query | string | Query to execute |
Returns: | object | Result object or false if error |
Returns most recently create unique ID (of INSERT queries)
Returns: | integer | Last unique id created. |
Returns affected rows (of UPDATE and DELETE queries)
Returns: | integer | Last amount of affected rows. |
Quoting strings for insertion in SQL queries
$str | string | String |
Returns: | string | String, with quotes escaped |
(DUMMY) Returns the list of tables from the database
Returns: | array | Tables in an array (tablename is in both key and value) |
(DUMMY) Returns information about each field in the $table
$tableName | string | Table name |
Returns: | array | Field information in an associative array with fieldname => field row |
(DUMMY) Returns information about each index key in the $table
$tableName | string | Table name |
Returns: | array | Key information in a numeric array |
(DUMMY) mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!
$query | string | Query to execute |
Returns: | pointer | Result pointer |
Dummy function for setting table data. Create your own.
NOTICE: Handler to "table-locking" needs to be made probably!
$table | string | Table name |
Returns: | void | |
@todo Table locking tools? |
Dummy function for setting table data. Create your own.
NOTICE: Handler to "table-locking" needs to be made probably!
$table | string | Table name |
Returns: | void | |
@todo Table locking tools? |
[Describe function...]
$table | [type] | $table: ... |
$where | [type] | $where: ... |
Returns: | [type] | ... |
[Describe function...]
$table | [type] | $table: ... |
$config | [type] | $config: ... |
&$itemKeys | [type] | $itemKeys: ... |
Returns: | [type] | ... |
[Describe function...]
$keys | [type] | $keys: ... |
$table | [type] | $table: ... |
$fieldList | [type] | $fields: ... |
Returns: | [type] | ... |
Parses any single SQL query
$parseString | string | SQL query |
Returns: | array | Result array with all the parts in - or error message string |
@see compileSQL(), debug_testSQL() |
Parsing SELECT query
$parseString | string | SQL string with SELECT query to parse |
Returns: | mixed | Returns array with components of SELECT query on success, otherwise an error message string. |
@see compileSELECT() |
Parsing UPDATE query
$parseString | string | SQL string with UPDATE query to parse |
Returns: | mixed | Returns array with components of UPDATE query on success, otherwise an error message string. |
@see compileUPDATE() |
Parsing INSERT query
$parseString | string | SQL string with INSERT query to parse |
Returns: | mixed | Returns array with components of INSERT query on success, otherwise an error message string. |
@see compileINSERT() |
Parsing DELETE query
$parseString | string | SQL string with DELETE query to parse |
Returns: | mixed | Returns array with components of DELETE query on success, otherwise an error message string. |
@see compileDELETE() |
Parsing EXPLAIN query
$parseString | string | SQL string with EXPLAIN query to parse |
Returns: | mixed | Returns array with components of EXPLAIN query on success, otherwise an error message string. |
@see parseSELECT() |
Parsing CREATE TABLE query
$parseString | string | SQL string starting with CREATE TABLE |
Returns: | mixed | Returns array with components of CREATE TABLE query on success, otherwise an error message string. |
@see compileCREATETABLE() |
Parsing ALTER TABLE query
$parseString | string | SQL string starting with ALTER TABLE |
Returns: | mixed | Returns array with components of ALTER TABLE query on success, otherwise an error message string. |
@see compileALTERTABLE() |
Parsing DROP TABLE query
$parseString | string | SQL string starting with DROP TABLE |
Returns: | mixed | Returns array with components of DROP TABLE query on success, otherwise an error message string. |
Parsing the fields in the "SELECT [$selectFields] FROM" part of a query into an array.
The output from this function can be compiled back into a field list with ->compileFieldList()
Will detect the keywords "DESC" and "ASC" after the table name; thus is
can be used for parsing the more simply ORDER BY and GROUP BY field
lists as well!
&$parseString | string | The string with fieldnames, eg. "title, uid AS myUid, max(tstamp), count(*)" etc. NOTICE: passed by reference! |
$stopRegex='' | string | Regular expressing to STOP parsing, eg. '^(FROM)([[:space:]]*)' |
Returns: | array | If successful parsing, returns an array, otherwise an error string. |
@see compileFieldList() |
Parsing the tablenames in the "FROM [$parseString] WHERE" part of a query into an array.
The success of this parsing determines if that part of the query is supported by TYPO3.
&$parseString | string | list of tables, eg. "pages, tt_content" or "pages A, pages B". NOTICE: passed by reference! |
$stopRegex='' | string | Regular expressing to STOP parsing, eg. '^(WHERE)([[:space:]]*)' |
Returns: | array | If successful parsing, returns an array, otherwise an error string. |
@see compileFromTables() |
Parsing the WHERE clause fields in the "WHERE [$parseString] ..." part of a query into a multidimensional array.
The success of this parsing determines if that part of the query is supported by TYPO3.
&$parseString | string | WHERE clause to parse. NOTICE: passed by reference! |
$stopRegex='' | string | Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' |
Returns: | mixed | If successful parsing, returns an array, otherwise an error string. |
Parsing the WHERE clause fields in the "WHERE [$parseString] ..." part of a query into a multidimensional array.
The success of this parsing determines if that part of the query is supported by TYPO3.
&$parseString | string | WHERE clause to parse. NOTICE: passed by reference! |
$stopRegex='' | string | Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' |
Returns: | mixed | If successful parsing, returns an array, otherwise an error string. |
Strips of a part of the parseString and returns the matching part.
Helper function for the parsing methods.
&$parseString | string | Parse string; if $regex finds anything the value of the first () level will be stripped of the string in the beginning. Further $parseString is left-trimmed (on success). Notice; parsestring is passed by reference. |
$regex | string | Regex to find a matching part in the beginning of the string. Rules: You MUST start the regex with "^" (finding stuff in the beginning of string) and the result of the first parenthesis is what will be returned to you (and stripped of the string). Eg. '^(AND|OR|&&)[[:space:]]+' will return AND, OR or && if found and having one of more whitespaces after it, plus shorten $parseString with that match and any space after (by ltrim()) |
$trimAll=FALSE | boolean | If set the full match of the regex is stripped of the beginning of the string! |
Returns: | string | The value of the first parenthesis level of the REGEX. |
Finds value in beginning of $parseString, returns result and strips it of parseString
&$parseString | string | The parseString, eg. "(0,1,2,3) ..." or "('asdf','qwer') ..." or "1234 ..." or "'My string value here' ..." |
$comparator='' | string | The comparator used before. If "NOT IN" or "IN" then the value is expected to be a list of values. Otherwise just an integer (un-quoted) or string (quoted) |
Returns: | string | The value (string/integer). Otherwise an array with error message in first key (0) |
Get value in quotes from $parseString.
NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
&$parseString | string | String from which to find value in quotes. Notice that $parseString is passed by reference and is shortend by the output of this function. |
$quote | string | The quote used; input either " or ' |
Returns: | string | The value, passed through stripslashes() ! |
Strip slashes function used for parsing
NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
$str | string | Input string |
Returns: | string | Output string |
Add slashes function used for compiling queries
NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
$str | string | Input string |
Returns: | string | Output string |
Setting the internal error message value, $this->parse_error and returns that value.
$msg | string | Input error message |
$restQuery | string | Remaining query to parse. |
Returns: | string | Error message. |
Trimming SQL as preparation for parsing.
";" in the end is stripped of.
White space is trimmed away around the value
A single space-char is added in the end
$str | string | Input string |
Returns: | string | Output string |
Compiles an SQL query from components
$components | array | Array of SQL query components |
Returns: | string | SQL query |
@see parseSQL() |
Compiles a SELECT statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL SELECT query |
@see parseSELECT() |
Compiles an UPDATE statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL UPDATE query |
@see parseUPDATE() |
Compiles an INSERT statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL INSERT query |
@see parseINSERT() |
Compiles an DELETE statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL DELETE query |
@see parseDELETE() |
Compiles a CREATE TABLE statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL CREATE TABLE query |
@see parseCREATETABLE() |
Compiles an ALTER TABLE statement from components array
$components | array | Array of SQL query components |
Returns: | string | SQL ALTER TABLE query |
@see parseALTERTABLE() |
Compiles a "SELECT [output] FROM..:" field list based on input array (made with ->parseFieldList())
Can also compile field lists for ORDER BY and GROUP BY.
$selectFields | array | Array of select fields, (made with ->parseFieldList()) |
Returns: | string | Select field string |
@see parseFieldList() |
Compiles a "FROM [output] WHERE..:" table list based on input array (made with ->parseFromTables())
$tablesArray | array | Array of table names, (made with ->parseFromTables()) |
Returns: | string | Table name string |
@see parseFromTables() |
Implodes an array of WHERE clause configuration into a WHERE clause.
NOTICE: MIGHT BY A TEMPORARY FUNCTION. Use for debugging only!
$clauseArray | array | WHERE clause configuration |
Returns: | string | WHERE clause as string. |
@see explodeWhereClause() |
Compile field definition
$fieldCfg | array | Field definition parts |
Returns: | string | Field definition string |
Check parsability of input SQL part string; Will parse and re-compile after which it is compared
$part | string | Part definition of string; "SELECT" = fieldlist (also ORDER BY and GROUP BY), "FROM" = table list, "WHERE" = Where clause. |
$str | string | SQL string to verify parsability of |
Returns: | mixed | Returns array with string 1 and 2 if error, otherwise false |
Compare two query strins by stripping away whitespace.
$str | string | SQL String 1 |
$newStr | string | SQL string 2 |
$caseInsensitive=FALSE | boolean | If true, the strings are compared insensitive to case |
Returns: | mixed | Returns array with string 1 and 2 if error, otherwise false |
Performs the ultimate test of the parser: Direct a SQL query in; You will get it back (through the parsed and re-compiled) if no problems, otherwise the script will print the error and exit
$SQLquery | string | SQL query |
Returns: | string | Query if all is well, otherwise exit. |
Returns the result set (in array) as HTML table. For debugging.
$array | array | Result set array (array of rows) |
Returns: | string | HTML table |
PHP SQL engine, result object
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Seeking position in result
$pointer | integer | Position pointer. |
Returns: | boolean | Returns true on success |
Class contains a bunch of cool functions for manipulating graphics with GDlib/Freetype and ImageMagick
VERY OFTEN used with gifbuilder that extends this class and provides a TypoScript API to using these functions
Filesize: | 76 K |
Func/Classes: | 53 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see tslib_gifBuilder |
Class contains a bunch of cool functions for manipulating graphics with GDlib/Freetype and ImageMagick
VERY OFTEN used with gifbuilder that extends this class and provides a TypoScript API to using these functions
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see tslib_gifBuilder |
Init function. Must always call this when using the class.
This function will read the configuration information from
$GLOBALS['TYPO3_CONF_VARS']['GFX'] can set some values in internal
variables.
Returns: | void |
Implements the "IMAGE" GIFBUILDER object, when the "mask" property is true.
It reads the two images defined by $conf['file'] and $conf['mask'] and
copies the $conf['file'] onto the input image pointer image using the
$conf['mask'] as a grayscale mask
The operation involves ImageMagick for combining.
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
Returns: | void | |
@see tslib_gifBuilder::make() |
Implements the "IMAGE" GIFBUILDER object, when the "mask" property is false (using only $conf['file'])
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
Returns: | void | |
@see tslib_gifBuilder::make(), maskImageOntoImage() |
Copies two GDlib image pointers onto each other, using TypoScript configuration from $conf and the input $workArea definition.
&$im | pointer | GDlib image pointer, destination (bottom image) |
$cpImg | pointer | GDlib image pointer, source (top image) |
$conf | array | TypoScript array with the properties for the IMAGE GIFBUILDER object. Only used for the "tile" property value. |
$workArea | array | Work area |
Returns: | void | Works on the $im image pointer |
Alternative function for using the similat PHP function imagecopyresized(). Used for GD2 only.
OK, the reason for this stupid fix is the following story:
GD1.x was capable of copying two images together and combining their palettes! GD2 is apparently not.
With GD2 only the palette of the dest-image is used which mostly results in totally black images when trying to
copy a color-ful image onto the destination.
The GD2-fix is to
1) Create a blank TRUE-COLOR image
2) Copy the destination image onto that one
3) Then do the actual operation; Copying the source (top image) onto that
4) ... and return the result pointer.
5) Reduce colors (if we do not, the result may become strange!)
It works, but the resulting images is now a true-color PNG which may be very large.
So, why not use 'imagetruecolortopalette ($im, TRUE, 256)' - well because it does NOT WORK! So simple is that.
For parameters, see PHP function "imagecopyresized()"
&$im | pointer | see PHP function "imagecopyresized()" |
$cpImg | pointer | see PHP function "imagecopyresized()" |
$Xstart | integer | see PHP function "imagecopyresized()" |
$Ystart | integer | see PHP function "imagecopyresized()" |
$cpImgCutX | integer | see PHP function "imagecopyresized()" |
$cpImgCutY | integer | see PHP function "imagecopyresized()" |
$w | integer | see PHP function "imagecopyresized()" |
$h | integer | see PHP function "imagecopyresized()" |
$w | integer | see PHP function "imagecopyresized()" |
$h | integer | see PHP function "imagecopyresized()" |
Returns: | void | |
@see t3lib_iconWorks::imagecopyresized() |
Implements the "TEXT" GIFBUILDER object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
Returns: | void | |
@see tslib_gifBuilder::make() |
Calculates text position for printing the text onto the image based on configuration like alignment and workarea.
$conf | array | TypoScript array for the TEXT GIFBUILDER object |
$workArea | array | Workarea definition |
$BB | array | Bounding box information, was set in tslib_gifBuilder::start() |
Returns: | array | [0]=x, [1]=y, [2]=w, [3]=h |
@see makeText() |
Calculates bounding box information for the TEXT GIFBUILDER object.
$conf | array | TypoScript array for the TEXT GIFBUILDER object |
Returns: | array | Array with three keys [0]/[1] being x/y and [2] being the bounding box array |
@see txtPosition(), tslib_gifBuilder::start() |
Adds an <area> tag to the internal variable $this->map which is used to accumulate the content for an ImageMap
$cords | array | Coordinates for a polygon image map as created by ->calcTextCordsForMap() |
$conf | array | Configuration for "imgMap." property of a TEXT GIFBUILDER object. |
Returns: | void | |
@see makeText(), calcTextCordsForMap() |
Calculating the coordinates for a TEXT string on an image map. Used in an <area> tag
$cords | array | Coordinates (from BBOX array) |
$offset | array | Offset array |
$conf | array | Configuration for "imgMap." property of a TEXT GIFBUILDER object. |
Returns: | array | |
@see makeText(), calcTextCordsForMap() |
Printing
text onto an image like the PHP function imageTTFText does but in
addition it offers options for spacing of letters and words.
Spacing is done by printing one char at a time and this means that the spacing is rather uneven and probably not very nice.
See
&$im | pointer | (See argument for PHP function imageTTFtext()) |
$fontSize | integer | (See argument for PHP function imageTTFtext()) |
$angle | integer | (See argument for PHP function imageTTFtext()) |
$x | integer | (See argument for PHP function imageTTFtext()) |
$y | integer | (See argument for PHP function imageTTFtext()) |
$Fcolor | integer | (See argument for PHP function imageTTFtext()) |
$fontFile | string | (See argument for PHP function imageTTFtext()) |
$text | string | (See argument for PHP function imageTTFtext()). UTF-8 string, possibly with entities in. |
$spacing | integer | The spacing of letters in pixels |
$wordSpacing | integer | The spacing of words in pixels |
Returns: | void |
Function that finds the right fontsize that will render the textstring within a certain width
$conf | array | The TypoScript properties of the TEXT GIFBUILDER object |
Returns: | integer | The new fontSize |
@author Rene Fritz <r.fritz@colorcube.de> | ||
@see tslib_gifBuilder::start() |
Implements the "OUTLINE" GIFBUILDER object / property for the TEXT object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
$txtConf | array | TypoScript array with configuration for the associated TEXT GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make(), makeText() |
Creates some offset values in an array used to simulate a circularly applied outline around TEXT
access private
$distance | integer | Distance |
$iterations | integer | Iterations. |
Returns: | array | |
@see makeOutline() |
Implements the "EMBOSS" GIFBUILDER object / property for the TEXT object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
$txtConf | array | TypoScript array with configuration for the associated TEXT GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make(), makeShadow() |
Implements the "SHADOW" GIFBUILDER object / property for the TEXT object
The operation involves ImageMagick for combining.
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
$txtConf | array | TypoScript array with configuration for the associated TEXT GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make(), makeText(), makeEmboss() |
Implements the "BOX" GIFBUILDER object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
$workArea | array | The current working area coordinates. |
Returns: | void | |
@see tslib_gifBuilder::make() |
Implements the "EFFECT" GIFBUILDER object
The operation involves ImageMagick for applying effects
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make(), applyImageMagickToPHPGif() |
Creating ImageMagick paramters from TypoScript property
$setup | string | A string with effect keywords=value pairs separated by "|" |
Returns: | string | ImageMagick prepared parameters. |
@see makeEffect() |
Implements the "ADJUST" GIFBUILDER object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make(), autoLevels(), outputLevels(), inputLevels() |
Implements the "CROP" GIFBUILDER object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make() |
Implements the "SCALE" GIFBUILDER object
&$im | pointer | GDlib image pointer |
$conf | array | TypoScript array with configuration for the GIFBUILDER object. |
Returns: | void | |
@see tslib_gifBuilder::make() |
Implements the "WORKAREA" GIFBUILDER object when setting it
Setting internal working area boundaries (->workArea)
$workArea | string | Working area dimensions, comma separated |
Returns: | void | |
@see tslib_gifBuilder::make() |
Apply auto-levels to input image pointer
&$im | integer | GDlib Image Pointer |
Returns: | void |
Apply output levels to input image pointer (decreasing contrast)
&$im | integer | GDlib Image Pointer |
$low | integer | The "low" value (close to 0) |
$high | integer | The "high" value (close to 255) |
$swap='' | boolean | If swap, then low and high are swapped. (Useful for negated masks...) |
Returns: | void |
Apply input levels to input image pointer (increasing contrast)
&$im | integer | GDlib Image Pointer |
$low | integer | The "low" value (close to 0) |
$high | integer | The "high" value (close to 255) |
$swap='' | boolean | If swap, then low and high are swapped. (Useful for negated masks...) |
Returns: | void |
Reduce colors in image
&$im | integer | GDlib Image Pointer |
$limit | integer | The max number of colors in the image before a reduction will happen; basically this means that IF the GD image current has the same amount or more colors than $limit define, THEN a reduction is performed. |
$cols | integer | Number of colors to reduce the image to. |
Returns: | void |
Checks if the $fontFile is already at an absolute path and if not, prepends the correct path.
Use PATH_site unless we are in the backend.
Call it by t3lib_stdGraphic::prependAbsolutePath()
$fontFile | string | The font file |
Returns: | string | The font file with absolute path. |
Returns the IM command for sharpening with ImageMagick 5 (when $this->V5_EFFECTS is set).
Uses $this->im5fx_sharpenSteps for translation of the factor to an actual command.
$factor | integer | The sharpening factor, 0-100 (effectively in 10 steps) |
Returns: | string | The sharpening command, eg. " -sharpen 3x4" |
@see makeText(), IMparams(), v5_blur() |
Returns the IM command for blurring with ImageMagick 5 (when $this->V5_EFFECTS is set).
Uses $this->im5fx_blurSteps for translation of the factor to an actual command.
$factor | integer | The blurring factor, 0-100 (effectively in 10 steps) |
Returns: | string | The blurring command, eg. " -blur 3x4" |
@see makeText(), IMparams(), v5_sharpen() |
Returns a random filename prefixed with "temp_" and then 32 char md5 hash (without extension) from $this->tempPath.
Used by functions in this class to create truely temporary files for
the on-the-fly processing. These files will most likely be deleted
right away.
Returns: | string |
Applies offset value to coordinated in $cords.
Basically the value of key 0/1 of $OFFSET is added to keys 0/1 of $cords
$cords | array | Integer coordinates in key 0/1 |
$OFFSET | array | Offset values in key 0/1 |
Returns: | array | Modified $cords array |
Converts a "HTML-color" TypoScript datatype to RGB-values.
Default is 0,0,0
$string | string | "HTML-color" data type string, eg. 'red', '#ffeedd' or '255,0,255'. You can also add a modifying operator afterwards. There are two options: "255,0,255 : 20" - will add 20 to values, result is "255,20,255". Or "255,0,255 : *1.23" which will multiply all RGB values with 1.23 |
Returns: | array | RGB values in key 0/1/2 of the array |
Recode string
Used with text strings for fonts when languages has other character sets.
$string | string | The text to recode |
Returns: | string | The recoded string. Should be UTF-8 output. MAY contain entities (eg. { or &#quot; which should render as real chars). |
Split a string into an array of individual characters
The function will look at $this->nativeCharset and if that is set,
the input string is expected to be UTF-8 encoded, possibly with
entities in it. Otherwise the string is supposed to be a single-byte
charset which is just splitted by a for-loop.
$theText | string | The text string to spli |
Returns: | array | Numerical array with a char as each value. |
Create an array with object position/boundaries based on input TypoScript configuration (such as the "align" property is used), the work area definition and $BB array
$conf | array | TypoScript configuration for a GIFBUILDER object |
$workArea | array | Workarea definition |
$BB | array | BB (Bounding box) array. Not just used for TEXT objects but also for others |
Returns: | array | [0]=x, [1]=y, [2]=w, [3]=h |
@see copyGifOntoGif(), makeBox(), crop() |
Converts $imagefile to another file in temp-dir of type $newExt (extension).
$imagefile | string | The image filepath |
$newExt='' | string | New extension, eg. "gif", "png", "jpg", "tif". If $newExt is NOT set, the new imagefile will be of the original format. If newExt = 'WEB' then one of the web-formats is applied. |
$w='' | string | Width. $w / $h is optional. If only one is given the image is scaled proportionally. If an 'm' exists in the $w or $h and if both are present the $w and $h is regarded as the Maximum w/h and the proportions will be kept |
$h='' | string | Height. See $w |
$params='' | string | Additional ImageMagick parameters. |
$frame='' | string | Refers to which frame-number to select in the image. '' or 0 will select the first frame, 1 will select the next and so on... |
$options='' | array | An array with options passed to getImageScale (see this function). |
$mustCreate=0 | boolean | If set, then another image than the input imagefile MUST be returned. Otherwise you can risk that the input image is good enough regarding messures etc and is of course not rendered to a new, temporary file in typo3temp/. But this option will force it to. |
Returns: | array | [0]/[1] is w/h, [2] is file extension and [3] is the filename. |
@see getImageScale(), typo3/show_item.php, fileList_ext::renderImage(), tslib_cObj::getImgResource(), SC_tslib_showpic::show(), maskImageOntoImage(), copyImageOntoImage(), scale() |
Gets the input image dimensions.
$imagefile | string | The image filepath |
Returns: | array | Returns an array where [0]/[1] is w/h, [2] is extension and [3] is the filename. |
@see imageMagickConvert(), tslib_cObj::getImgResource() |
Get numbers for scaling the image based on input
$info | array | Current image information: Width, Height etc. |
$w | integer | "required" width |
$h | integer | "required" height |
$options | array | Options: Keys are like "maxW", "maxH", "minW", "minH" |
Returns: | array | |
@see imageMagickConvert() |
Used to check if a certain process of scaling an image is already being carried out (can be logged in the SQL database)
$output | string | Output imagefile |
$orig='' | string | Original basis file |
Returns: | boolean | Returns true if the file is already being made; thus "true" means "Don't render the image again" |
Returns an array where [0]/[1] is w/h, [2] is extension and [3] is the filename.
Using ImageMagick
$imagefile | string | The absolute image filepath |
Returns: | array |
Executes a ImageMagick "convert" on two filenames, $input and $output using $params before them.
Can be used for many things, mostly scaling and effects.
$input | string | The absolute image filepath, input file (read from) |
$output | string | The absolute image filepath, output filename (written to) |
$params | string | ImageMagick parameters |
Returns: | string | The result of a call to PHP function "exec()" |
Executes
a ImageMagick "combine" (or composite in newer times) on four filenames
- $input, $overlay and $mask as input files and $output as the output
filename (written to)
Can be used for many things, mostly scaling and effects.
$input | string | The absolute image filepath, bottom file |
$overlay | string | The absolute image filepath, overlay file (top) |
$mask | string | The absolute image filepath, the mask file (grayscale) |
$output | string | The absolute image filepath, output filename (written to) |
Returns: | void |
Wrapping the input filename in double-quotes
$inputName | string | Input filename |
Returns: | string | The output wrapped in "" (if there are spaces in the filepath) |
Returns true if the input file existed
$file | string | Input file to check |
Returns: | string | Returns the filename if the file existed, otherwise empty. |
Applies an ImageMagick parameter to a GDlib image pointer resource by writing the resource to file, performing an IM operation upon it and reading back the result into the ImagePointer.
&$im | pointer | The image pointer (reference) |
$command | string | The ImageMagick parameters. Like effects, scaling etc. |
Returns: | void |
Returns
an image extension for an output image based on the number of pixels of
the output and the file extension of the original file.
For example: If the number of pixels exceeds $this->pixelLimitGif (normally 10000) then it will be a "jpg" string in return.
$type | string | The file extension, lowercase. |
$w | integer | The width of the output image. |
$h | integer | The height of the output image. |
Returns: | string | The filename, either "jpg" or "gif"/"png" (whatever $this->gifExtension is set to.) |
Writing the internal image pointer, $this->im, to file based on the extension of the input filename
Used in GIFBUILDER
Uses $this->setup['reduceColors'] for gif/png images and
$this->setup['quality'] for jpg images to reduce size/quality if
needed.
$file | string | The filename to write to. |
Returns: | string | Returns input filename |
@see tslib_gifBuilder::gifBuild() |
Destroy internal image pointer, $this->im
Returns: | void | |
@see tslib_gifBuilder::gifBuild() |
Returns Image Tag for input image information array.
$imgInfo | array | Image information array, key 0/1 is width/height and key 3 is the src value |
Returns: | string | Image tag for the input image information array. |
Writes the input GDlib image pointer to file
$destImg | pointer | The GDlib image resource pointer |
$theImage | string | The filename to write to |
Returns: | mixed | The output of either imageGif or imagePng based on whether the $this->gifExtension was set to "gif" or "png" |
@see maskImageOntoImage(), scale(), output() |
Creates a new GDlib image resource based on the input image filename.
If it fails creating a image from the input file a blank gray image
with the dimensions of the input image will be created instead.
$sourceImg | string | Image filename |
Returns: | pointer | Image Resource pointer |
Super Admin class has functions for the administration of multiple TYPO3 sites in folders
See 'misc/superadmin.php' for details on how to use!
$Id: t3lib_api.html,v 1.2 2004/03/22 16:37:55 typo3 Exp $
Revised for TYPO3 3.6 February/2004 by Kasper Skaarhoj
XHTML Compliant
Filesize: | 42 K |
Func/Classes: | 29 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> |
Debug function. Substitute since no config_default.php file is included anywhere
$p1 | mixed | Debug var |
$p2='' | string | Header string |
Returns: | void |
Super Admin class has functions for the administration of multiple TYPO3 sites in folders
NOTICE: Only compliant with single MySQL database usage per installation!
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialize with configuration - from the 'superadmin.php' script. See misc/superadmin.php for example.
$parentDirs | array | Numerical array with arrays having two keys, 'dir' and 'url' where 'dir' is the absolute path to a directory with TYPO3 installations inside. |
Returns: | void |
Main function, creating HTML content; frameset, menu, content frames.
Outputs the full HTML to browser.
Returns: | void |
Creates menu item from input.
$code | string | Value for "&exp" parameter |
$label | string | The label |
Returns: | string | Wrapped value |
Wrap string in red span tag (for errors)
$str | string | Input string |
Returns: | string | Output string |
Wraps input string in <h2>
$str | string | Input string |
Returns: | string | Output string, wrapped in <h2> |
Wraps input string in <h3>
$str | string | Input string |
Returns: | string | Output string, wrapped in <h3> |
Traverses the parent dirs, collecting the list of TYPO3 installations into $this->globalSiteInfo
Returns: | string | HTML content (The default view seen when starting the superadmin.php script) |
Creating information array for a specific TYPO3 installation
Information about site is stored in ->globalSiteInfo array
$path | string | Absolute path to installation (PATH_site) |
$dir | string | Directory of main directory (level under PATH_site) |
Returns: | string | HTML content with information about the site. |
@see initProcess() |
Includes "localconf" of a TYPO3 installation an loads $this->globalSiteInfo with this information.
$localconf | string | Absolute path to localconf.php file to include. |
Returns: | array | Array with information about the site. |
@see processSiteDir() |
Connects to a MySQL database with the TYPO3 db host/username/password and database as found in the localconf.php file!
This is NOT compatible with DBAL and connection will obviously just
fail with an error message if it turns out that the _DEFAULT handler of
a site is not in a MySQL database
$siteInfo | array | $siteInfo array, containing username/password/host/database values. |
Returns: | string | Array message if any |
Get database information, assuming standard tables like "be_users"
Adding the information to ->globalSiteInfo
$key | string | Key for site in ->globalSiteInfo |
Returns: | void | |
@see processSiteDir() |
Creates big table with information about all installations in ->globalSiteInfo
Returns: | string | HTML table |
Based on the globalSiteInfo array, this prints information about local extensions for each site.
In particular version number and most recent mod-time is interesting!
Returns: | string | HTML |
Gets information for an extension, eg. version and most-recently-edited-script
$path | string | Path to local extension folder |
$extKey | string | Extension key |
$k | string | Key to globalSiteInformation array |
Returns: | array | Information array (unless an error occured) |
Recursively gather all files and folders of extension path.
$fileArr | array | Array of files to which new files are added |
$extPath | string | Path to look up files in |
$extList='' | string | List of file extensions to include. Blank = all |
$regDirs=0 | boolean | If set, directories are included as well. |
Returns: | array | $fileArr with new entries added. |
Creates an array with modification times of all files in $fileArr
$fileArr | array | Files in extension (rel path) |
$extPath | string | Abs path prefix for files. |
Returns: | array | Array with modification times of files (filenames are keys) |
Removes the absolute part of all files/folders in fileArr
$fileArr | array | File array |
$extPath | string | Prefix to remove |
Returns: | array | Modified file array (or error string) |
Shows detailed information for a single installation of TYPO3
$exp | string | KEY pointing to installation |
Returns: | string | HTML content |
Compile log details into template string
$text | string | Log message (template) |
$data | array | Data array to insert in log message |
Returns: | string | Log details. |
Removing temp_CACHED files for installation
$exp | string | KEY pointing to installation |
Returns: | string | HTML content |
Menu for either update/information, showing links for each installation found
$exp | string | Action key "update" or "info" |
Returns: | string | HTML output. |
Setting new passwords
Returns: | string | Status |
@see changeAdminPasswordsForm() |
Syntax Highlighting class.
Filesize: | 11.5 K |
Func/Classes: | 7 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Syntax Highlighting class.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Makes syntax highlighting of a Data Structure, <T3DataStructure>
$str | string | Data Structure XML, must be valid since it's parsed. |
Returns: | string | HTML code with highlighted content. Must be wrapped in <PRE> tags |
Making syntax highlighting of the parsed Data Structure XML.
Called recursively.
$struct | array | The structure, see splitXMLbyTags() |
$parent='' | string | Parent tag. |
$app='' | string | "Application" - used to denote if we are 'inside' a section |
Returns: | string | HTML |
Makes syntax highlighting of a FlexForm Data, <T3FlexForms>
$str | string | Data Structure XML, must be valid since it's parsed. |
Returns: | string | HTML code with highlighted content. Must be wrapped in <PRE> tags |
Making syntax highlighting of the parsed FlexForm XML.
Called recursively.
$struct | array | The structure, see splitXMLbyTags() |
$parent='' | string | Parent tag. |
$app='' | string | "Application" - used to denote if we are 'inside' a section |
Returns: | string | HTML |
Returning all tag names found in XML/HTML input string
$str | string | HTML/XML input |
Returns: | array | Array with all found tags (starttags only) |
Splitting the input source by the tags listing in $tagList.
Called recursively.
$tagList | string | Commalist of tags to split source by (into blocks, ALL being block-tags!) |
$str | string | Input string. |
Returns: | array | Array with the content arranged hierarchically. |
'TCEforms' - Class for creating the backend editing forms.
Filesize: | 147 K |
Func/Classes: | 84 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @coauthor Rene Fritz <r.fritz@colorcube.de> @package TYPO3 @subpackage t3lib |
'TCEforms' - Class for creating the backend editing forms.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@coauthor Rene Fritz <r.fritz@colorcube.de> | ||
@package TYPO3 | ||
@subpackage t3lib |
Constructor function, setting internal variables, loading the styles used.
Returns: | void |
Will return the TCEform element for just a single field from a record.
The field must be listed in the currently displayed fields (as found in [types][showitem]) for the record.
This also means that the $table/$row supplied must be complete so the list of fields to show can be found correctly
$table | string | The table name |
$row | array | The record from the table for which to render a field. |
$theFieldToReturn | string | The field name to return the TCEform element for. |
Returns: | string | HTML output |
@see getMainFields() |
Based on the $table and $row of content, this displays the complete TCEform for the record.
The input-$row is required to be preprocessed if necessary by eg. the
t3lib_transferdata class. For instance the RTE content should be
transformed through this class first.
$table | string | The table name |
$row | array | The record from the table for which to render a field. |
$depth=0 | integer | Depth level |
Returns: | string | HTML output |
@see getSoloField() |
Will return the TCEform elements for a pre-defined list of fields.
Notice that this will STILL use the configuration found in the list
[types][showitem] for those fields which are found there. So ideally
the list of fields given as argument to this function should also be in
the current [types][showitem] list of the record.
Used for displaying forms for the frontend edit icons for instance.
$table | string | The table name |
$row | array | The record array. |
$list | string | Commalist of fields from the table. These will be shown in the specified order in a form. |
Returns: | string | TCEform elements in a string. |
Creates a palette (collection of secondary options).
$table | string | The table name |
$row | array | The row array |
$palette | string | The palette number/pointer |
$header='' | string | Header string for the palette (used when in-form). If not set, no header item is made. |
$itemList='' | string | Optional alternative list of fields for the palette |
$collapsedHeader='' | string | Optional Link text for activating a palette (when palettes does not have another form element to belong to). |
Returns: | string | HTML code. |
Returns the form HTML code for a database table field.
$table | string | The table name |
$field | string | The field name |
$row | array | The record to edit from the database table. |
$altName='' | string | Alternative field name label to show. |
$palette=0 | boolean | Set this if the field is on a palette (in top frame), otherwise not. (if set, field will render as a hidden field). |
$extra='' | string | The "extra" options from "Part 4" of the field configurations found in the "types" "showitem" list. Typically parsed by $this->getSpecConfFromString() in order to get the options as an associative array. |
$pal=0 | integer | The palette pointer. |
Returns: | mixed | String (normal) or array (palettes) |
Rendering a single item for the form
$table | string | Table name of record |
$field | string | Fieldname to render |
$row | array | The record |
&$PA | array | parameters array containing a lot of stuff. Value by Reference! |
Returns: | string | Returns the item as HTML code to insert |
@see getSingleField(), getSingleField_typeFlex_draw() |
Generation of TCEform elements of the type "input"
This will render a single-line input form field, possibly with various control/validation features
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "text"
This will render a <textarea> OR RTE area form field, possibly with various control/validation features
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "check"
This will render a check-box OR an array of checkboxes
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "radio"
This will render a series of radio buttons.
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "select"
This will render a selector box element, or possibly a special
construction with two selector boxes. That depends on configuration.
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "group"
This will render a selectorbox into which elements from either the file system or database can be inserted. Relations.
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Generation of TCEform elements of the type "none"
This will render a non-editable display of the content of the field.
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Handler for Flex Forms
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Creates the language menu for FlexForms:
$languages | [type] | $languages: ... |
$elName | [type] | $elName: ... |
$selectedLanguage | [type] | $selectedLanguage: ... |
$multi=1 | [type] | $multi: ... |
Returns: | string | HTML for menu |
Creates the menu for selection of the sheets:
$sArr | array | Sheet array for which to render the menu |
$elName | string | Form element name of the field containing the sheet pointer |
$sheetKey | string | Current sheet key |
Returns: | string | HTML for menu |
[Describe function...]
$dataStruct | [type] | $dataStruct: ... |
$editData | [type] | $editData: ... |
$cmdData | [type] | $cmdData: ... |
$table | [type] | $table: ... |
$field | [type] | $field: ... |
$row | [type] | $row: ... |
&$PA | [type] | $PA: ... |
$formPrefix='' | [type] | $formPrefix: ... |
$level=0 | [type] | $level: ... |
$tRows=array() | [type] | $tRows: ... |
Returns: | [type] | ... |
Handler for unknown types.
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
User defined field type
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | string | The HTML code for the TCEform field |
Calculate and return the current "types" pointer value for a record
$table | string | The table name. MUST be in $TCA |
$row | array | The row from the table, should contain at least the "type" field, if applicable. |
Returns: | string | Return the "type" value for this record, ready to pick a "types" configuration from the $TCA array. |
Used to adhoc-rearrange the field order normally set in the [types][showitem] list
$fields | array | A [types][showitem] list of fields, exploded by "," |
Returns: | array | Returns rearranged version (keys are changed around as well.) |
@see getMainFields() |
Producing
an array of field names NOT to display in the form, based on settings
from subtype_value_field, bitmask_excludelist_bits etc.
Notice, this list is in NO way related to the "excludeField" flag
$table | string | Table name, MUST be in $TCA |
$row | array | A record from table. |
$typeNum | string | A "type" pointer value, probably the one calculated based on the record array. |
Returns: | array | Array with fieldnames as values. The fieldnames are those which should NOT be displayed "anyways" |
@see getMainFields() |
Finds possible field to add to the form, based on subtype fields.
$table | string | Table name, MUST be in $TCA |
$row | array | A record from table. |
$typeNum | string | A "type" pointer value, probably the one calculated based on the record array. |
Returns: | array | An array containing two values: 1) Another array containing fieldnames to add and 2) the subtype value field. |
@see getMainFields() |
Merges the current [types][showitem] array with the array of fields to add for the current subtype field of the "type" value.
$fields | array | A [types][showitem] list of fields, exploded by "," |
$fieldsToAdd | array | The output from getFieldsToAdd() |
Returns: | array | Return the modified $fields array. |
@see getMainFields(),getFieldsToAdd() |
Returns TSconfig for table/row
Multiple requests to this function will return cached content so there
is no performance loss in calling this many times since the information
is looked up only once.
$table | string | The table name |
$row | array | The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.) |
$field='' | string | Optionally you can specify the field name as well. If that case the TSconfig for the field is returned. |
Returns: | mixed | The TSconfig values (probably in an array) |
@see t3lib_BEfunc::getTCEFORM_TSconfig() |
Returns the "special" configuration (from the "types" "showitem" list) for a fieldname based on input table/record
(Not used anywhere...?)
$table | string | The table name |
$row | array | The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.) |
$field | string | Specify the field name. |
Returns: | array | |
@see getSpecConfFromString(), t3lib_BEfunc::getTCAtypes() |
Returns the "special" configuration of an "extra" string (non-parsed)
$extraString | string | The "Part 4" of the fields configuration in "types" "showitem" lists. |
Returns: | array | An array with the special options in. |
@see getSpecConfForField(), t3lib_BEfunc::getSpecConfParts() |
Prints the selector box form-field for the db/file/select elements (multiple)
$fName | string | Form element name |
$mode | string | Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type) |
$allowed | string | Commalist of "allowed" |
$itemArray | array | The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs. |
$selector='' | string | Alternative selector box. |
$params=array() | array | An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails" |
$onFocus='' | string | On focus attribute string |
Returns: | string | The form fields for the selection. |
Rendering wizards for form fields.
$itemKinds | array | Array with the real item in the first value, and an alternative item in the second value. |
$wizConf | array | The "wizard" key from the config array for the field (from TCA) |
$table | string | Table name |
$row | array | The record array |
$field | string | The field name |
&$PA | array | Additional configuration array. (passed by reference!) |
$itemName | string | The field name |
$specConf | array | Special configuration if available. |
$RTE=0 | boolean | Whether the RTE could have been loaded. |
Returns: | string | The new item value. |
Get icon (for example for selector boxes)
$icon | string | Icon reference |
Returns: | array | Array with two values; the icon file reference, the icon file information array (getimagesize()) |
Wraps a string with a link to the palette.
$header | string | The string to wrap in an A-tag |
$table | string | The table name for which to open the palette. |
$row | array | The record array |
$palette | integer | The palette pointer. |
$retFunc=0 | boolean | Determines the output type of the function. |
Returns: | mixed | If $retFunc is set, then returns an array with icon code and palette JavaScript function. Otherwise just the icon code. |
Creates checkbox parameters
$itemName | string | Form element name |
$thisValue | integer | The value of the checkbox (representing checkboxes with the bits) |
$c | integer | Checkbox # (0-9?) |
$iCount | integer | Total number of checkboxes in the array. |
$addFunc='' | string | Additional JavaScript for the onclick handler. |
Returns: | string | The onclick attribute + possibly the checked-option set. |
Returns element reference for form element name
$itemName | string | Form element name |
Returns: | string | Form element reference (JS) |
Returns the "No title" string if the input $str is empty.
$str | string | The string which - if empty - will become the no-title string. |
$wrapParts=array() | array | Array with wrappin parts for the no-title output (in keys [0]/[1]) |
Returns: | string |
Returns 'this.blur();' string, if supported.
Returns: | string | If the current browser supports styles, the string 'this.blur();' is returned. |
Returns the form field for a single HIDDEN field.
(Not used anywhere...?)
$table | string | Table name |
$field | string | Field name |
$row | array | The row |
Returns: | string | The hidden-field <input> tag. |
Returns parameters to set the width for a <input>-element
$size=48 | integer | The abstract size value (1-48) |
$textarea=0 | boolean | If this is for a text area. |
Returns: | string | Either a "style" attribute string or "cols"/"size" attribute string. |
Returns parameters to set with for a textarea field
$size=48 | integer | The abstract width (1-48) |
$wrap='' | string | Empty or "off" (text wrapping in the field or not) |
Returns: | string | The "cols" attribute string (or style from formWidth()) |
@see formWidth() |
Get style CSS values for the current field type.
$type | string | Field type (eg. "check", "radio", "select") |
Returns: | string | CSS attributes |
Return default "style" attribute line.
$type | string | Field type (eg. "check", "radio", "select") |
Returns: | string | CSS attributes |
Initialize item array (for checkbox, selectorbox, radio buttons)
Will resolve the label value.
$fieldValue | array | The "columns" array for the field (from TCA) |
Returns: | array | An array of arrays with three elements; label, value, icon |
Merges items into an item-array
$items | array | The existing item array |
$iArray | array | An array of items to add. NOTICE: The keys are mapped to values, and the values and mapped to be labels. No possibility of adding an icon. |
Returns: | array | The updated $item array |
Perform user processing of the items arrays of checkboxes, selectorboxes and radio buttons.
$items | array | The array of items (label,value,icon) |
$iArray | array | The "itemsProcFunc." from fieldTSconfig of the field. |
$config | array | The config array for the field. |
$table | string | Table name |
$row | array | Record row |
$field | string | Field name |
Returns: | array | The modified $items array |
Add selector box items of more exotic kinds.
$items | array | The array of items (label,value,icon) |
$fieldValue | array | The "columns" array for the field (from TCA) |
$TSconfig | array | TSconfig for the table/row |
$field | string | The fieldname |
Returns: | array | The $items array modified. |
Creates value/label pair for a backend module (main and sub)
$value | string | The module key |
Returns: | string | The rawurlencoded 2-part string to transfer to interface |
@see addSelectOptionsToItemArray() |
Adds records from a foreign table (for selector boxes)
$items | array | The array of items (label,value,icon) |
$fieldValue | array | The 'columns' array for the field (from TCA) |
$TSconfig | array | TSconfig for the table/row |
$field | string | The fieldname |
$pFFlag=0 | boolean | If set, then we are fetching the 'neg_' foreign tables. |
Returns: | array | The $items array modified. |
@see addSelectOptionsToItemArray(), t3lib_BEfunc::exec_foreign_table_where_query() |
This inserts the content of $inArr into the field-template
$inArr | array | Array with key/value pairs to insert in the template. |
$altTemplate='' | string | Alternative template to use instead of the default. |
Returns: | string |
Overwrite this function in own extended class to add own markers for output
$marker | array | Array with key/value pairs to insert in the template. |
$table | string | The table name of the record |
$field | string | The field name which this element is supposed to edit |
$row | array | The record data array where the value(s) for the field can be found |
&$PA | array | An array with additional configuration options. |
Returns: | array | marker array for template output |
@see function intoTemplate() |
Wrapping labels
Currently not implemented - just returns input value.
$str | string | Input string. |
Returns: | string | Output string. |
Wraps all the table rows into a single table.
Used externally from scripts like alt_doc.php and db_layout.php (which uses TCEforms...)
$c | string | Code to output between table-parts; table rows |
$rec | array | The record |
$table | string | The table name |
Returns: | string |
This replaces markers in the total wrap
$arr | array | An array of template parts containing some markers. |
$rec | array | The record |
$table | string | The table name |
Returns: | string |
Wraps an element in the $out_array with the template row for a "section" ($this->sectionWrap)
&$out_array | array | The array with form elements stored in (passed by reference and changed!) |
&$out_pointer | integer | The pointer to the entry in the $out_array (passed by reference and incremented!) |
Returns: | void |
Replaces colorscheme markers in the template string
$inTemplate | string | Template string with markers to be substituted. |
Returns: | string |
Returns divider.
Currently not implemented and returns only blank value.
Returns: | string |
Creates HTML output for a palette
$palArr | array | The palette array to print |
Returns: | string | HTML output |
Returns help-text ICON if configured for.
$table | string | The table name |
$field | string | The field name |
$force=0 | boolean | Force the return of the help-text icon. |
Returns: | string | HTML, <a>-tag with |
Returns help text DESCRIPTION, if configured for.
$table | string | The table name |
$field | string | The field name |
Returns: | string |
Setting the current color scheme ($this->colorScheme) based on $this->defColorScheme plus input string.
$scheme | string | A color scheme string. |
Returns: | void |
JavaScript code used for input-field evaluation.
$formname='forms[0]' | string | The identification of the form on the page. |
Returns: | string | A <script></script> section with JavaScript. |
JavaScript code used for input-field evaluation.
Example use:
$msg.='Distribution time (hh:mm dd-mm-yy):<br /><input
type="text" name="send_mail_datetime_hr"
onchange="typo3FormFieldGet(\'send_mail_datetime\', \'datetime\', \'\',
0,0);"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /><input
type="hidden" value="'.time().'" name="send_mail_datetime" /><br
/>';
$this->extJSCODE.='typo3FormFieldSet("send_mail_datetime", "datetime", "", 0,0);';
... and then include the result of this function after the form
$formname='forms[0]' | string | The identification of the form on the page. |
Returns: | string | A <script></script> section with JavaScript. |
Used to connect the db/file browser with this document and the formfields on it!
$formObj='document.forms[0]' | string | Form object reference (including "document.") |
Returns: | string | JavaScript functions/code (NOT contained in a <script>-element) |
Prints necessary JavaScript for TCEforms (after the form HTML).
Returns: | void |
Gets default record. Maybe not used anymore. FE-editor?
$table | string | Database Tablename |
$pid=0 | integer | PID value (positive / negative) |
Returns: | array | "default" row. |
Return record path (visually formatted, using t3lib_BEfunc::getRecordPath() )
$table | string | Table name |
$rec | array | Record array |
Returns: | string | The record path. |
@see t3lib_BEfunc::getRecordPath() |
Returns the select-page read-access SQL clause.
Returns cached string, so you can call this function as much as you like without performance loss.
Returns: | string |
Fetches language label for key
$str | string | Language label reference, eg. 'LLL:EXT:lang/locallang_core.php:labels.blablabla' |
Returns: | string | The value of the label, fetched for the current backend language. |
Returns language label from locallang_core.php
Labels must be prefixed with either "l_" or "m_".
The prefix "l_" maps to the prefix "labels." inside locallang_core.php
The prefix "m_" maps to the prefix "mess." inside locallang_core.php
$str | string | The label key |
Returns: | string | The value of the label, fetched for the current backend language. |
Returns true, if the palette, $palette, is collapsed (not shown, but found in top-frame) for the table.
$table | string | The table name |
$palette | integer | The palette pointer/number |
Returns: | boolean |
Returns true, if the evaluation of the required-field code is OK.
$displayCond | string | The required-field code |
$row | array | The record to evaluate |
Returns: | boolean |
Return TSCpid (cached)
Using t3lib_BEfunc::getTSCpid()
$table | string | Tablename |
$uid | string | UID value |
$pid | string | PID value |
Returns: | integer | Returns the REAL pid of the record, if possible. If both $uid and $pid is strings, then pid=-1 is returned as an error indication. |
@see t3lib_BEfunc::getTSCpid() |
Returns true if descriptions should be loaded always
$table | string | Table for which to check |
Returns: | boolean |
Returns an array of available languages (to use for FlexForms)
$onlyIsoCoded=1 | boolean | If set, only languages which are paired with a static_info_table / static_language record will be returned. |
$setDefault=1 | boolean | If set, an array entry for a default language is set. |
Returns: | array |
Extension class for the rendering of TCEforms in the frontend
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> |
Function for wrapping labels.
$str | string | The string to wrap |
Returns: | string |
Prints the palette in the frontend editing (forms-on-page?)
$palArr | array | The palette array to print |
Returns: | string | HTML output |
Frontend Timetracking functions
Is used to register how much time is used with operations in TypoScript
Used by index_ts
Filesize: | 18.3 K |
Func/Classes: | 16 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_tsfeBeUserAuth, tslib_fe, tslib_cObj, TSpagegen |
Frontend Timetracking functions
Is used to register how much time is used with operations in TypoScript
Used by index_ts
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_tsfeBeUserAuth, tslib_fe, tslib_cObj, TSpagegen |
Pushes an element to the TypoScript tracking array
$tslabel | string | Label string for the entry, eg. TypoScript property name |
$value='' | string | Additional value(?) |
Returns: | void | |
@see tslib_cObj::cObjGetSingle(), pull() |
Pulls an element from the TypoScript tracking array
$content='' | string | The content string generated within the push/pull part. |
Returns: | void | |
@see tslib_cObj::cObjGetSingle(), push() |
Logs the TypoScript entry
$content | string | The message string |
$num=0 | integer | Message type: 0: information, 1: message, 2: warning, 3: error |
Returns: | void | |
@see tslib_cObj::CONTENT() |
Set TSselectQuery - for messages in TypoScript debugger.
$query | string | Query string |
$msg | string | Message/Label to attach |
Returns: | void |
Increases the stack pointer
Returns: | void | |
@see decStackPointer(), TSpagegen::renderContent(), tslib_cObj::cObjGetSingle() |
Decreases the stack pointer
Returns: | void | |
@see incStackPointer(), TSpagegen::renderContent(), tslib_cObj::cObjGetSingle() |
Returns microtime input to milliseconds
$microtime | string | PHP microtime string |
Returns: | integer |
Print TypoScript parsing log
Returns: | string | HTML table with the information about parsing times. |
@see t3lib_tsfeBeUserAuth::extGetCategory_tsdebug() |
Recursively generates the content to display
&$arr | array | Array which is modified with content. Reference |
$content | string | Current content string for the level |
$depthData='' | string | Prefixed icons for new PM icons |
$first=0 | boolean | Set this for the first call from outside. |
$vKey='' | string | Seems to be the previous tsStackLog key |
Returns: | string | Returns the $content string generated/modified. Also the $arr array is modified! |
Wraps the input content string in green colored font-tags IF the length o fthe input string exceeds $this->printConf['contentLength'] (or $this->printConf['contentLength_FILE'] if $v == "FILE"
$c | string | The content string |
$v | string | Command: If "FILE" then $this->printConf['contentLength_FILE'] is used for content length comparison, otherwise $this->printConf['contentLength'] |
Returns: | string |
Wraps input string in a <font> tag with verdana, black and size 1
$str | string | The string to be wrapped |
Returns: | string |
Helper function for internal data manipulation
&$arr | array | Array (passed by reference) and modified |
$pointer | integer | Pointer value |
$uniqueId | string | Unique ID string |
Returns: | void | |
@see printTSlog() |
This prints out a TYPO3 error message.
$header | string | Header string |
$text | string | Message string |
$js | boolean | If set, then this will produce a alert() line for inclusion in JavaScript. |
Returns: | string |
Class for getting and transforming data for display in backend forms (TCEforms)
Filesize: | 33 K |
Func/Classes: | 19 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Class for getting and transforming data for display in backend forms (TCEforms)
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
A function which can be used for load a batch of records from $table into internal memory of this object.
The function is also used to produce proper default data for new records
Ultimately the function will call renderRecord()
$table | string | Table name, must be found in $TCA |
$idList | string | Comma list of id values. If $idList is "prev" then the value from $this->prevPageID is used. NOTICE: If $operation is "new", then negative ids are meant to point to a "previous" record and positive ids are PID values for new records. Otherwise (for existing records that is) it is straight forward table/id pairs. |
$operation | string | If "new", then a record with default data is returned. Further, the $id values are meant to be PID values (or if negative, pointing to a previous record). If NOT new, then the table/ids are just pointing to an existing record! |
Returns: | void | |
@see renderRecord() |
This
function performs processing on the input $row array and stores
internally a corresponding array which contains processed values, ready
to pass on to the TCEforms rendering in the frontend!
The objective with this function is to prepare the content for handling in TCEforms.
Default values from outside/TSconfig is added by fetchRecord(). In this
function default values from TCA is used if a field is NOT defined in
$row.
The resulting, processed row is stored in
$this->regTableItems_data[$uniqueItemRef], where $uniqueItemRef is
"[tablename]_[id-value]"
$table | string | The table name |
$id | string | The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record. |
$pid | integer | The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page) |
$row | array | The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()). |
Returns: | void | |
@see fetchRecord() |
Function with the switch() construct which triggers functions for processing of the data value depending on the TCA-config field type.
$data | string | Value to process |
$fieldConfig | array | TCA/columns array for field (independant of TCA for flexforms - coming from XML then) |
$TSconfig | array | TSconfig (blank for flexforms for now) |
$table | string | Table name |
$row | array | The row array, always of the real record (also for flexforms) |
$field | string | The field (empty for flexforms!) |
Returns: | string | Modified $value |
Processing of the data value in case the field type is "group"
$data | string | The field value |
$fieldConfig | array | TCA field config |
$TSconfig | array | TCEform TSconfig for the record |
$table | string | Table name |
$row | array | The row |
$field | string | Field name |
Returns: | string | The processed input field value ($data) |
@see renderRecord() |
Processing of the data value in case the field type is "select"
$data | string | The field value |
$fieldConfig | array | TCA field config |
$TSconfig | array | TCEform TSconfig for the record |
$table | string | Table name |
$row | array | The row |
$field | string | Field name |
Returns: | string | The processed input field value ($data) |
@see renderRecord() |
Processing of the data value in case the field type is "select"
$data | string | The field value |
$fieldConfig | array | TCA field config |
$TSconfig | array | TCEform TSconfig for the record |
$table | string | Table name |
$row | array | The row |
$field | string | Field name |
Returns: | string | The processed input field value ($data) |
@see renderRecord() |
Processing of the content in $totalRecordcontent based on settings in the types-configuration
$totalRecordContent | array | The array of values which has been processed according to their type (eg. "group" or "select") |
$types_fieldConfig | array | The "types" configuration for the current display of fields. |
$tscPID | integer | PAGE TSconfig PID |
$table | string | Table name |
$pid | integer | PID value |
Returns: | array | The processed version of $totalRecordContent |
Function traversing sheets/languages for flex form data structures
$dataPart | array | Data array |
$dataStructArray | array | Data Structure array |
$pParams | array | Various parameters to pass-through |
Returns: | array | Modified $dataPart array. |
@see t3lib_TCEmain::checkValue_flex_procInData(), renderRecord_flexProc_procInData_travDS() |
Traverse data array / structure
&$dataValues | array | Data array passed by reference. |
$DSelements | array | Data structure |
$pParams | array | Various parameters pass-through. |
Returns: | void | |
@see renderRecord_flexProc_procInData(), t3lib_TCEmain::checkValue_flex_procInData_travDS() |
Adding "special" types to the $dataAcc array of selector items
$dataAcc | array | Array with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed. |
$elements | array | The array of original elements - basically the field value exploded by "," |
$specialKey | string | The "special" key from the TCA config of the field. Determines the type of processing in here. |
Returns: | array | Modified $dataAcc array |
@see renderRecord_selectProc() |
Adds the foreign record elements to $dataAcc, if any
$dataAcc | array | Array with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed. |
$elements | array | The array of original elements - basically the field value exploded by "," |
$fieldConfig | array | Field configuration from TCA |
$field | string | The field name |
$TSconfig | array | TSconfig for the record |
$row | array | The record |
Returns: | array | Modified $dataAcc array |
@see renderRecord_selectProc() |
Returning the id-list processed by loadDBgroup for the foreign tables.
$elements | array | The array of original elements - basically the field value exploded by "," |
$fieldConfig | array | Field configuration from TCA |
$row | array | The data array, currently. Used to set the "local_uid" for selecting MM relation records. |
Returns: | array | An array with ids of the records from the input elements array. |
Processing of selector box items. This includes the automated adding of elements plus user-function processing.
$selItems | array | The elements to process |
$config | array | TCA/columns configuration |
$fieldTSConfig | array | TSconfig for the field |
$table | string | The table name |
$row | array | The current row |
$field | string | The field name |
Returns: | array | The modified input $selItems array |
@see renderRecord_selectProc() |
Adding items from $iArray to $items array
$items | array | The array of selector box items to which key(value) / value(label) pairs from $iArray will be added. |
$iArray | array | The array of elements to add. The keys will become values. The value will become the label. |
Returns: | array | The modified input $items array |
@see procesItemArray() |
User processing of a selector box array of values.
$items | array | The array of selector box items |
$itemsProcFuncTSconfig | array | TSconfig for the fields itemProcFunc |
$config | array | TCA/columns configuration |
$table | string | The table name |
$row | array | The current row |
$field | string | The field name |
Returns: | array | The modified input $items array |
@see procesItemArray() |
Sets the lock for a record from table/id, IF $this->lockRecords is set!
$table | string | The table name |
$id | integer | The id of the record |
$pid=0 | integer | The pid of the record |
Returns: | void |
Dummy function, can be used to "register" records. Used by eg. the "show_item" script.
$table | string | Table name |
$id | integer | Record id |
$field | string | Field name |
$content | string | Field content. |
Returns: | void | |
@see renderRecord() |
Local wrapper function for LANG->sL (returning language labels)
$in | string | Language label key |
Returns: | string | Localized label value. |
Base class for creating a browsable array/page/folder tree in HTML
Filesize: | 29 K |
Func/Classes: | 32 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @coauthor René Fritz <r.fritz@colorcube.de> @package TYPO3 @subpackage t3lib @see t3lib_browsetree, t3lib_pagetree, t3lib_foldertree |
Base class for creating a browsable array/page/folder tree in HTML
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@coauthor René Fritz <r.fritz@colorcube.de> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_browsetree, t3lib_pagetree, t3lib_foldertree |
Initialize the tree class. Needs to be overwritten
Will set ->fieldsArray, ->backPath and ->clause
$clause='' | string | record WHERE clause |
$orderByFields='' | string | record ORDER BY field |
Returns: | void |
Sets the tree name which is used to identify the tree
Used for JavaScript and other things
$treeName='' | string | Default is the table name. Underscores are stripped. |
Returns: | void |
Adds a fieldname to the internal array ->fieldArray
$field | string | Field name to |
$noCheck=0 | boolean | If set, the fieldname will be set no matter what. Otherwise the field name must either be found as key in $TCA[$table]['columns'] or in the list ->defaultList |
Returns: | void |
Resets the tree, recs, ids, and ids_hierarchy internal variables. Use it if you need it.
Returns: | void |
Will create and return the HTML code for a browsable tree
Is based on the mounts found in the internal array ->MOUNTS (set in the constructor)
Returns: | string | HTML code for the browsable tree |
Compiles the HTML code for displaying the structure found inside the ->tree array
$treeArr='' | array | "tree-array" - if blank string, the internal ->tree array is used. |
Returns: | string | The HTML code for the tree |
Generate the plus/minus icon for the browsable tree.
$row | array | record for the entry |
$a | integer | The current entry number |
$c | integer | The total number of entries. If equal to $a, a "bottom" element is returned. |
$nextCount | integer | The number of sub-elements to the current element. |
$exp | boolean | The element was expanded to render subelements if this flag is set. |
Returns: | string | Image tag with the plus/minus icon. |
@see t3lib_pageTree::PMicon() |
Wrap the plus/minus icon in a link
$icon | string | HTML string to wrap, probably an image tag. |
$cmd | string | Command for 'PM' get var |
$bMark='' | boolean | If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark) |
Returns: | string | Link-wrapped input string |
Wrapping $title in a-tags.
$title | string | Title string |
$row | string | Item record |
$bank=0 | integer | Bank pointer (which mount point number) |
Returns: | string |
Wrapping the image tag, $icon, for the row, $row (except for mount points)
$icon | string | The image tag for the icon |
$row | array | The row for the current element |
Returns: | string | The processed icon input value. |
Adds attributes to image tag.
$icon | string | Icon image tag |
$attr | string | Attributes to add, eg. ' border="0"' |
Returns: | string | Image tag, modified with $attr attributes added. |
Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set
$str | string | Input string, like a page title for the tree |
$row | array | record row with "php_tree_stop" field |
Returns: | string | Modified string |
Returns true/false if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag.
Extending parent function
$id | integer | record id/key |
Returns: | boolean | |
@see t3lib_pageTree::expandNext() |
Get stored tree structure AND updating it if needed according to incoming PM GET var.
Returns: | void |
Saves the content of ->stored (keeps track of expanded positions in the tree)
$this->treeName will be used as key for BE_USER->uc[] to store it in
Returns: | void |
Returns the root icon for a tree/mountpoint (defaults to the globe)
$rec | array | Record for root. |
Returns: | string | Icon image tag. |
Get icon for the row.
If $this->iconPath and $this->iconName is set, try to get icon based on those values.
$row | array | Item row. |
Returns: | string | Image tag. |
Returns the title for the input record. If blank, a "no title" labele (localized) will be returned.
Do NOT htmlspecialchar the string from this function - has already been done.
$row | array | The input row array (where the key "title" is used for the title) |
$titleLen=30 | integer | Title length (30) |
Returns: | string | The title. |
Returns the value for the image "title" attribute
$row | array | The input row array (where the key "title" is used for the title) |
Returns: | string | The attribute value (is htmlspecialchared() already) |
@see wrapIcon() |
Returns the id from the record (typ. uid)
$row | array | Record array |
Returns: | integer | The "uid" field value. |
Returns jump-url parameter value.
$row | array | The record array. |
Returns: | string | The jump-url parameter. |
Fetches the data for the tree
$uid | integer | item id for which to select subitems (parent id) |
$depth=999 | integer | Max depth (recursivity limit) |
$depthData='' | string | HTML-code prefix for recursive calls. |
$blankLineCode='' | string | ? (internal) |
Returns: | integer | The count of items on the level |
Returns the number of records having the parent id, $uid
$uid | integer | id to count subitems for |
Returns: | integer |
Returns root record for uid (<=0)
$uid | integer | uid, <= 0 (normally, this does not matter) |
Returns: | array | Array with title/uid keys with values of $this->title/0 (zero) |
Returns the record for a uid.
For tables: Looks up the record in the database.
For arrays: Returns the fake record for uid id.
$uid | integer | UID to look up |
Returns: | array | The record |
Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id.
For tables: This will make a database query to select all children to "parent"
For arrays: This will return key to the ->dataLookup array
$parentId | integer | parent item id |
Returns: | mixed | data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.) |
Getting the tree data: Counting elements in resource
&$res | mixed | data handle |
Returns: | integer | number of items |
@see getDataInit() |
Getting the tree data: next entry
&$res | mixed | data handle |
Returns: | array | item data array OR FALSE if end of elements. |
@see getDataInit() |
Getting the tree data: frees data handle
&$res | mixed | data handle |
Returns: | void |
Used to initialize class with an array to browse.
The array inputted will be traversed and an internal index for lookup is created.
The keys of the input array are perceived as "uid"s of records which means that keys GLOBALLY must be unique like uids are.
"uid" and "pid" "fakefields" are also set in each record.
All other fields are optional.
&$dataArr | array | The input array, see examples below in this script. |
$traverse=FALSE | boolean | Internal, for recursion. |
$pid=0 | integer | Internal, for recursion. |
Returns: | void |
Sets the internal data arrays
&$treeArr | array | Content for $this->data |
&$treeLookupArr | array | Content for $this->dataLookup |
Returns: | void |
TYPO3 backend user authentication in the TSFE frontend.
This includes mainly functions related to the Admin Panel
Filesize: | 44 K |
Func/Classes: | 26 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
TYPO3 backend user authentication in the TSFE frontend.
This includes mainly functions related to the Admin Panel
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialize the usage of Admin Panel.
Called from index_ts.php if a backend users is correctly logged in.
Sets $this->extAdminConfig to the "admPanel" config for the user and $this->extAdmEnabled = 1 IF access is enabled.
Returns: | void |
Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
Called from index_ts.php - in the end of the script
Returns: | string | HTML for the Admin Panel |
@see index_ts.php |
Creates the content for the "preview" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Creates the content for the "cache" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Creates the content for the "publish" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Creates the content for the "edit" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Creates the content for the "tsdebug" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Creates the content for the "info" section ("module") of the Admin Panel
$out='' | string | Optional start-value; The generated content is added to this variable. |
Returns: | string | HTML content for the section. Consists of a string with table-rows with four columns. |
@see extPrintFeAdminDialog() |
Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
It will have a plus/minus icon and a label which is linked so that it
submits the form which surrounds the whole Admin Panel when clicked,
alterting the TSFE_ADMIN_PANEL[display_'.$pre.'] value
See the functions extGetCategory_*
$pre | string | The suffix to the display_ label. Also selects the label from the LOCAL_LANG array. |
Returns: | string | HTML table row. |
@see extGetItem() |
Wraps a string in a link which will open/close a certain part of the Admin Panel
$pre | string | The code for the display_ label/key |
$str | string | Input string |
Returns: | string | Linked input string |
@see extGetHead() |
Returns a row (with 4 columns) for content in a section of the Admin Panel.
It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
$pre | string | Key to label |
$element | string | The HTML content for the forth table cell. |
Returns: | string | HTML table row. |
@see extGetHead() |
Wraps a string in a font-tag with verdana, size 1 and black
$str | string | The string to wrap |
Returns: | string |
Creates the tool bar links for the "edit" section of the Admin Panel.
Returns: | string | A string containing images wrapped in <a>-tags linking them to proper functions. |
Implementing the access checks that the typo3/init.php script does before a user is ever logged in.
Used in the frontend.
Returns: | boolean | Returns true if access is OK |
@see typo3/init.php, t3lib_beuserauth::backendCheckLogin() |
Evaluates if the Backend User has read access to the input page record.
The evaluation is based on both read-permission and whether the page is
found in one of the users webmounts. Only if both conditions are true
will the function return true.
Read access means that previewing is allowed etc.
Used in index_ts.php
$pageRec | array | The page record to evaluate for |
Returns: | boolean | True if read access |
Checks if a Admin Panel section ("module") is available for the user. If so, true is returned.
$key | string | The module key, eg. "edit", "preview", "info" etc. |
Returns: | boolean | |
@see extPrintFeAdminDialog() |
Saves any change in settings made in the Admin Panel.
Called from index_ts.php right after access check for the Admin Panel
Returns: | void |
Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
$pre | string | Module key |
$val='' | string | Setting key |
Returns: | string | The setting value |
Returns true if admin panel module is open
$pre | string | Module key |
Returns: | boolean | True, if the admin panel is open for the specified admin panel module key. |
Generates a list of Page-uid's from $id. List does not include $id itself
The only pages excluded from the list are deleted pages.
$id | integer | Start page id |
$depth | integer | Depth to traverse down the page tree. |
$begin=0 | integer | $begin is an optional integer that determines at which level in the tree to start collecting uid's. Zero means 'start right away', 1 = 'next level and out' |
$perms_clause | string | Perms clause |
Returns: | string | Returns the list with a comma in the end (if any pages selected!) |
Returns the number of cached pages for a page id.
$page_id | integer | The page id. |
Returns: | integer | The number of pages for this page in the table "cache_pages" |
Returns
the label for key, $key. If a translation for the language set in
$this->uc['lang'] is found that is returned, otherwise the default
value.
IF the global variable $LOCAL_LANG is NOT an array (yet) then this
function loads the global $LOCAL_LANG array with the content of
"sysext/lang/locallang_tsfe.php" so that the values therein can be used
for labels in the Admin Panel
$key | string | Key for a label in the $LOCAL_LANG array of "sysext/lang/locallang_tsfe.php" |
Returns: | string | The value for the $key |
Returns true in an edit-action is sent from the Admin Panel
Returns: | boolean | |
@see index_ts.php |
Returns true if an edit form is shown on the page.
Used from index_ts.php where a true return-value will result in classes etc. being included.
Returns: | boolean | |
@see index_ts.php |
Management of the on-page frontend editing forms and edit panels.
Basically taking in the data and commands and passes them on to the proper classes as they should be.
Returns: | void | |
@see index_ts.php |
The TypoScript parser
Filesize: | 25 K |
Func/Classes: | 13 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_tstemplate, t3lib_matchcondition, t3lib_BEfunc::getPagesTSconfig(), t3lib_userAuthGroup::fetchGroupData(), t3lib_TStemplate::generateConfig() |
The TypoScript parser
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_tstemplate, t3lib_matchcondition, t3lib_BEfunc::getPagesTSconfig(), t3lib_userAuthGroup::fetchGroupData(), t3lib_TStemplate::generateConfig() |
Start parsing the input TypoScript text piece. The result is stored in $this->setup
$string | string | The TypoScript text |
$matchObj='' | object | If is object (instance of t3lib_matchcondition), then this is used to match conditions found in the TypoScript code. If matchObj not specified, then no conditions will work! (Except [GLOBAL]) |
Returns: | void |
Will search for the next condition. When found it will return the line content (the condition value) and have advanced the internal $this->rawP pointer to point to the next line after the condition.
Returns: | string | The condition value |
@see parse() |
Parsing the $this->raw TypoScript lines from pointer, $this->rawP
&$setup | array | Reference to the setup array in which to accumulate the values. |
Returns: | string | Returns the string of the condition found, the exit signal or possible nothing (if it completed parsing with no interruptions) |
Parsing of TypoScript keys inside a curly brace where the key is composite of at least two keys, thus having to recursively call itself to get the value
$string | string | The object sub-path, eg "thisprop.another_prot" |
&$setup | array | The local setup array from the function calling this function |
Returns: | string | Returns the exitSignal |
@see parseSub() |
Get a value/property pair for an object path in TypoScript, eg. "myobject.myvalue.mysubproperty". Here: Used by the "copy" operator, <
$string | string | Object path for which to get the value |
$setup | array | Global setup code if $string points to a global object path. But if string is prefixed with "." then its the local setup array. |
Returns: | array | An array with keys 0/1 being value/property respectively |
Setting a value/property of an object string in the setup array.
$string | string | The object sub-path, eg "thisprop.another_prot" |
&$setup | array | The local setup array from the function calling this function. |
$value | array | The value/property pair array to set. If only one of them is set, then the other is not touched (unless $wipeOut is set, which it is when copies are made which must include both value and property) |
$wipeOut=0 | boolean | If set, then both value and property is wiped out when a copy is made of another value. |
Returns: | void |
Stacks errors/messages from the TypoScript parser into an internal array, $this->error
If "TT" is a global object (as it is in the frontend when backend users
are logged in) the message will be registered here as well.
$err | string | The error message string |
$num=2 | integer | The error severity (in the scale of $GLOBALS['TT']->setTSlogMessage: Approx: 2=warning, 1=info, 0=nothing, 3=fatal.) |
Returns: | void |
Checks the input string (un-parsed TypoScript) for include-commands ("<INCLUDE_TYPOSCRIPT: ....")
Use: t3lib_TSparser::checkIncludeLines()
$string | string | Unparsed TypoScript |
Returns: | string | Complete TypoScript with includes added. |
Parses the string in each value of the input array for include-commands
$array | array | Array with TypoScript in each value |
Returns: | array | Same array but where the values has been parsed for include-commands |
Syntax highlight a TypoScript text
Will parse the content. Remember, the internal setup array may contain INvalid parsed content since conditions are ignored!
$string | string | The TypoScript text |
$lineNum='' | mixed | If blank, linenumbers are NOT printed. If array then the first key is the linenumber offset to add to the internal counter. |
$highlightBlockMode=0 | boolean | If set, then the highlighted output will be formatted in blocks based on the brace levels. prespace will be ignored and empty lines represented with a single no-break-space. |
Returns: | string | HTML code for the syntax highlighted string |
Registers a part of a TypoScript line for syntax highlighting.
$code | string | Key from the internal array $this->highLightStyles |
$pointer | integer | Pointer to the line in $this->raw which this is about |
$strlen=-1 | integer | The number of chars LEFT on this line before the end is reached. |
Returns: | void | |
@see parse() |
Formatting the TypoScript code in $this->raw based on the data collected by $this->regHighLight in $this->highLightData
$lineNumDat | mixed | If blank, linenumbers are NOT printed. If array then the first key is the linenumber offset to add to the internal counter. |
$highlightBlockMode | boolean | If set, then the highlighted output will be formatted in blocks based on the brace levels. prespace will be ignored and empty lines represented with a single no-break-space. |
Returns: | string | HTML content |
@see doSyntaxHighlight() |
Template object that is responsible for generating the TypoScript template based on template records.
Filesize: | 56 K |
Func/Classes: | 25 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see t3lib_tsparser.php, t3lib_matchcondition.php |
Template object that is responsible for generating the TypoScript template based on template records.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see t3lib_tsparser.php, t3lib_matchcondition.php |
Initialize
MUST be called directly after creating a new template-object
Returns: | void | |
@see tslib_fe::initTemplate() |
Fetches the "currentPageData" array from cache
NOTE about currentPageData:
It holds information about the TypoScript conditions along with the list of template uid's which is used on the page.
In the getFromCache function in TSFE, currentPageData is used to
evaluate if there is a template and if the matching conditions are
alright
Unfortunately this does not take into account if the templates in the
rowSum of currentPageData has changed composition, eg. due to hidden
fields or start/end time.
So if a template is hidden or times out, it'll not be discovered unless
the page is regenerated - at least the this->start function must be
called, because this will make a new portion of data in currentPageData
string
Returns: | mixed | The array $this->currentPageData if found cached in "cache_pagesection". If the string "none" was returned it means the array must be generated and stored in the cache-table |
@see start(), t3lib_fe::getFromCache() |
Fetches data about which TypoScript-matches there are at this page. Then it performs a matchingtest.
$cc | array | An array with three keys, "all", "rowSum" and "rootLine" - all coming from the $this->currentPageData array |
Returns: | array | The input array but with a new key added, "match" which contains the items from the "all" key which when passed to tslib_matchCondition returned true. |
@see t3lib_matchCondition, t3lib_fe::getFromCache() |
This is all about fetching the right TypoScript template structure. If it's not cached then it must be generated and cached!
The method traverse the rootline structure from out to in, fetches the
hierarchy of template records and based on this either finds the cached
TypoScript template structure or parses the template and caches it for
next time.
Sets $this->setup to the parsed TypoScript Template array
$theRootLine | array | The rootline of the current page (going ALL the way to tree root) |
Returns: | void | |
@see tslib_fe::getConfigArray() |
Traverses
the rootLine from the root and out. For each page it checks if there is
a template record. If there is a template record,
$this->processTemplate() is called.
Resets and affects internal variables like $this->constants, $this->config, $this->editorcfg and $this->rowSum
Also creates $this->rootLine which is a root line stopping at the
root template (contrary to $GLOBALS['TSFE']->rootLine which goes all
the way to the root of the tree
$theRootLine | array | The rootline of the current page (going ALL the way to tree root) |
$start_template_uid=0 | integer | Set specific template record UID to select; this is only for debugging/development/analysis use in backend modules like "Web > Template". For parsing TypoScript templates in the frontend it should be 0 (zero) |
Returns: | void | |
@see start() |
Checks if the template ($row) has some included templates and after including them it fills the arrays with the setup
Builds up $this->rowSum
$row | array | A full TypoScript template record (sys_template/static_template/forged "dummy" record made from static template file) |
$idList | string | A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion. |
$pid | array | The PID of the input template record |
$templateID='' | string | The id of the current template. Same syntax as $idList ids, eg. "sys_123" |
$templateParent='' | string | Parent template id (during recursive call); Same syntax as $idList ids, eg. "sys_123" |
Returns: | void | |
@see runThroughTemplates() |
Includes static template records (from static_template table) and static template files (from extensions) for the input template record row.
$idList | string | A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion. |
$templateID | string | The id of the current template. Same syntax as $idList ids, eg. "sys_123" |
$pid | array | The PID of the input template record |
$row | array | A full TypoScript template record |
Returns: | void | |
@see processTemplate() |
Adds the default TypoScript files for extensions if any.
$idList | string | A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion. |
$templateID | string | The id of the current template. Same syntax as $idList ids, eg. "sys_123" |
$pid | array | The PID of the input template record |
$row | array | A full TypoScript template record |
Returns: | void | |
@see includeStaticTypoScriptSources() |
Appends (not prepends) additional TypoScript code to static template records/files as set in TYPO3_CONF_VARS
For records the "uid" value is the integer of the "static_template" record
For files the "uid" value is the extension key but with any underscores
removed. Possibly with a path if its a static file selected in the
template record
$subrow | array | Static template record/file |
Returns: | array | Returns the input array where the values for keys "config", "constants" and "editorcfg" may have been modified with prepended code. |
@see addExtensionStatics(), includeStaticTypoScriptSources() |
Generates the configuration array by replacing constants and parsing the whole thing.
Depends on $this->config and $this->constants to be set prior to this! (done by processTemplate/runThroughTemplates)
Returns: | void | |
@see t3lib_TSparser, start() |
Searching
TypoScript code text (for constants, config (Setup) and editorcfg) for
include instructions and does the inclusion if needed.
Modifies
Returns: | void | |
@see t3lib_TSparser, generateConfig() |
Loads Page TSconfig until the outermost template record and parses the configuration - if TSFE.constants object path is found it is merged with the default data in here!
$constArray | array | Constants array, default input. |
Returns: | array | Constants array, modified |
@todo Apply caching to the parsed Page TSconfig. This is done in the other similar functions for both frontend and backend. However, since this functions works for BOTH frontend and backend we will have to either write our own local caching function or (more likely) detect if we are in FE or BE and use caching functions accordingly. Not having caching affects mostly the backend modules inside the "Template" module since the overhead in the frontend is only seen when TypoScript templates are parsed anyways (after which point they are cached anyways...) |
This flattens a hierarchical TypoScript array to $this->flatSetup
$setupArray | array | TypoScript array |
$prefix | string | Prefix to the object path. Used for recursive calls to this function. |
$resourceFlag | boolean | If set, then the constant value will be resolved as a TypoScript "resource" data type. Also used internally during recursive calls so that all subproperties for properties named "file." will be resolved as resources. |
Returns: | void | |
@see generateConfig() |
Substitutes the constants from $this->flatSetup in the text string $all
$all | string | TypoScript code text string |
Returns: | string | The processed string with all constants found in $this->flatSetup as key/value pairs substituted. |
@see generateConfig(), flattenSetup() |
Implementation of the "optionSplit" feature in TypoScript (used eg. for MENU objects)
What it does is to split the incoming TypoScript array so that the
values are exploded by certain strings ("||" and "|*|") and each part
distributed into individual TypoScript arrays with a similar structure,
but individualized values.
The concept is known as "optionSplit" and is rather advanced to handle
but quite powerful, in particular for creating menus in TYPO3.
$conf | array | A TypoScript array |
$splitCount | integer | The number of items for which to generated individual TypoScript arrays |
Returns: | array | The individualized TypoScript array. |
@see tslib_cObj::IMGTEXT(), tslib_menu::procesItemStates() | ||
@link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=289&cHash=6604390b37 |
Returns the reference to a 'resource' in TypoScript.
This could be from the filesystem if '/' is found in the value $fileFromSetup, else from the resource-list
$fileFromSetup | string | TypoScript "resource" data type value. |
Returns: | string | Resulting filename, if any. |
Searches for the TypoScript resource filename in the list of resource filenames.
$res | string | The resource file name list (from $this->setup['resources']) |
$file | string | The resource value to match |
Returns: | string | If found, this will be the resource filename that matched. Typically this file is found in "uploads/tf/" |
@see getFileName() |
CheckFile runs through the $menuArr and checks every file-reference in $name
(Not used anywhere)
$name | string | Property name in the menu array |
$menuArr | array | Menu array to traverse |
Returns: | array | Modified menu array |
@depreciated | ||
@internal |
Compiles the content for the page <title> tag.
$title | string | The input title string, typically the "title" field of a page's record. |
$no_title=0 | boolean | If set, then only the site title is outputted (from $this->setup['sitetitle']) |
$titleFirst=0 | boolean | If set, then "sitetitle" and $title is swapped |
Returns: | string | The page title on the form "[sitetitle]: [input-title]". Not htmlspecialchar()'ed. |
@see tslib_fe::tempPageCacheContent(), TSpagegen::renderContentWithHeader() |
Reads the fileContent of $fName and returns it.
The same as t3lib_div::getUrl()
$fName | string | Absolute filepath to record |
Returns: | string | The content returned |
@see tslib_cObj::fileResource(), tslib_cObj::MULTIMEDIA(), t3lib_div::getUrl() |
Ordinary "wrapping" function. Used in the tslib_menu class and extension classes instead of the similar function in tslib_cObj
$content | string | The content to wrap |
$wrap | string | The wrap value, eg. "<b> | </b>" |
Returns: | string | Wrapped input string |
@see tslib_menu, tslib_cObj::wrap() |
The mother of all functions creating links/URLs etc in a TypoScript environment.
See the references below.
Basically this function takes care of issues such as type,id,alias and
Mount Points, simulate static documents, M5/B6 encoded parameters etc.
It is important to pass all links created through this function since
this is the guarantee that globally configured settings for link
creating are observed and that your applications will conform to the
various/many configuration options in TypoScript Templates regarding
this.
$page | array | The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, no_cache, title and sectionIndex_uid. |
$oTarget | string | Default target string to use IF not $page['target'] is set. |
$no_cache | boolean | If set, then the "&no_cache=1" parameter is included in the URL. |
$script | string | Alternative script name if you don't want to use $GLOBALS['TSFE']->config['mainScript'] (normally set to "index.php") |
$overrideArray='' | array | Array with overriding values for the $page array. |
$addParams='' | string | Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed. |
$typeOverride='' | string | If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found. |
Returns: | array | Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL" |
@see tslib_frameset::frameParams(), tslib_cObj::typoLink(), tslib_cObj::SEARCHRESULT(), TSpagegen::pagegenInit(), tslib_menu::link() |
Removes the "?" of input string IF the "?" is the last character.
$url | string | Input string |
Returns: | string | Output string, free of "?" in the end, if any such character. |
@see linkData(), tslib_frameset::frameParams() |
Takes
a TypoScript array as input and returns an array which contains all
integer properties found which had a value (not only properties). The
output array will be sorted numerically.
Call it like t3lib_TStemplate::sortedKeyList()
$setupArr | array | TypoScript array with numerical array in |
Returns: | array | An array with all integer properties listed in numeric order. |
@see tslib_cObj::cObjGet(), tslib_gifBuilder, tslib_imgmenu::makeImageMap() |
Authentication of users in TYPO3
This class is used to authenticate a login user.
The class is used by both the frontend and backend. In both cases this class is a parent class to beuserauth and feuserauth
See Inside TYPO3 for more information about the API of the class and internal variables.
Filesize: | 28 K |
Func/Classes: | 18 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Authentication of users in TYPO3
This class is used to authenticate a login user.
The class is used by both the frontend and backend. In both cases this class is a parent class to beuserauth and feuserauth
See Inside TYPO3 for more information about the API of the class and internal variables.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Starts a user session
Typical configurations will:
a) check if session cookie was set and if not, set one,
b) check if a password/username was sent and if so, try to authenticate the user
c) Lookup a session attached to a user and check timeout etc.
d) Garbage collection, setting of no-cache headers.
If a user is authenticated the database record of the user (array) will be set in the ->user internal variable.
Returns: | void |
Checks if a submission of username and password is present
Returns: | string | Returns "login" if login, "logout" if logout, or empty if $F_status was none of these values. |
@internal |
Log out current user!
Removes the current session record, sets the internal ->user array
to a blank string; Thereby the current user (if any) is effectively
logged out!
Returns: | void |
This returns the where-clause needed to select the user with respect flags like deleted, hidden, starttime, endtime
Returns: | string |
This returns the where-clause needed to lock a user to the IP address
Returns: | string |
This writes $variable to the user-record. This is a way of providing session-data.
You can fetch the data again through $this->uc in this class!
If $variable is not an array, $this->uc is saved!
$variable='' | array | An array you want to store for the user as session data. If $variable is not supplied (is blank string), the internal variable, ->uc, is stored by default |
Returns: | void |
DUMMY: Writes to log database table (in some extension classes)
$type | integer | $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent |
$action | integer | $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!) |
$error | integer | $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin) |
$details_nr | integer | $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages |
$details | string | $details: Default text that follows the message |
$data | array | $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text... |
$tablename | string | $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
$recuid | integer | $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
$recpid | integer | $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
Returns: | void | |
@see t3lib_userauthgroup::writelog() |
Sets $theUC as the internal variable ->uc IF $theUC is an array. If $theUC is false, the 'uc' content from the ->user array will be unserialized and restored in ->uc
$theUC='' | mixed | If an array, then set as ->uc, otherwise load from user record |
Returns: | void |
Stores data for a module.
The data is stored with the session id so you can even check upon
retrieval if the module data is from a previous session or from the
current session.
$module | string | $module is the name of the module ($MCONF['name']) |
$data | mixed | $data is the data you want to store for that module (array, string, ...) |
$noSave=0 | boolean | If $noSave is set, then the ->uc array (which carries all kinds of user data) is NOT written immediately, but must be written by some subsequent call. |
Returns: | void |
Gets module data for a module (from a loaded ->uc array)
$module | string | $module is the name of the module ($MCONF['name']) |
$type='' | string | If $type = 'ses' then module data is returned only if it was stored in the current session, otherwise data from a previous session will be returned (if available). |
Returns: | mixed | The module data if available: $this->uc['moduleData'][$module]; |
Returns the session data stored for $key.
The data will last only for this login session since it is stored in the session table.
$key | string | Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table. |
Returns: | mixed |
Sets the session data ($data) for $key and writes all session data (from ->user['ses_data']) to the database.
The data will last only for this login session since it is stored in the session table.
$key | string | Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table. |
$data | mixed | The variable to store in index $key |
Returns: | void |
Raw initialization of the be_user with uid=$uid
This will circumvent all login procedures and select a be_users record
from the database and set the content of ->user to the record
selected. Thus the BE_USER object will appear like if a user was
authenticated - however without a session id and the fields from the
session table of course.
Will check the users for disabled, start/endtime, etc. ($this->user_where_clause())
$uid | integer | The UID of the backend user to set in ->user |
Returns: | void | |
@params integer 'uid' of be_users record to select and set. | ||
@internal | ||
@see SC_mod_tools_be_user_index::compareUsers(), SC_mod_user_setup_index::simulateUser(), freesite_admin::startCreate() |
Raw initialization of the be_user with username=$name
$name | string | The username to look up. |
Returns: | void | |
@see t3lib_userAuth::setBeUserByUid() | ||
@internal |
Extension to class.t3lib_userauth.php; Authentication of users in TYPO3 Backend
Actually this class is extended again by t3lib_beuserauth which is the actual backend user class that will be instantiated.
In fact the two classes t3lib_beuserauth and this class could just as
well be one, single class since t3lib_userauthgroup is not - to my
knowledge - used separately elsewhere. But for historical reasons they
are two separate classes.
Filesize: | 38 K |
Func/Classes: | 25 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Extension to class.t3lib_userauth.php; Authentication of users in TYPO3 Backend
Actually this class is extended again by t3lib_beuserauth which is the actual backend user class that will be instantiated.
In fact the two classes t3lib_beuserauth and this class could just as
well be one, single class since t3lib_userauthgroup is not - to my
knowledge - used separately elsewhere. But for historical reasons they
are two separate classes.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Returns true if user is admin
Basically this function evaluates if the ->user[admin] field has bit 0 set. If so, user is admin.
Returns: | boolean |
Returns true if the current user is a member of group $groupId
$groupId must be set. $this->groupList must contain groups
Will return true also if the user is a member of a group through subgroups.
$groupId | integer | Group ID to look for in $this->groupList |
Returns: | boolean |
Checks if the permissions is granted based on a page-record ($row) and $perms (binary and'ed)
Bits for permissions, see $perms variable:
1 - Show: See/Copy page and the pagecontent.
16- Edit pagecontent: Change/Add/Delete/Move pagecontent.
2- Edit page: Change/Move the page, eg. change title, startdate, hidden.
4- Delete page: Delete the page and pagecontent.
8- New pages: Create new pages under the page.
$row | array | $row is the pagerow for which the permissions is checked |
$perms | integer | $perms is the binary representation of the permission we are going to check. Every bit in this number represents a permission that must be set. See function explanation. |
Returns: | boolean | True or False upon evaluation |
Checks if the page id, $id, is found within the webmounts set up for the user.
This should ALWAYS be checked for any page id a user works with, whether it's about reading, writing or whatever.
The point is that this will add the security that a user can NEVER
touch parts outside his mounted pages in the page tree. This is
otherwise possible if the raw page permissions allows for it. So this
security check just makes it easier to make safe user configurations.
If the user is admin OR if this feature is disabled (fx. by setting
TYPO3_CONF_VARS['BE']['lockBeUserToDBmounts']=0) then it returns "1"
right away
Otherwise the function will return the uid of the webmount which was first found in the rootline of the input page $id
$id | integer | Page ID to check |
$readPerms='' | string | Content of "->getPagePermsClause(1)" (read-permissions). If not set, they will be internally calculated (but if you have the correct value right away you can save that database lookup!) |
$exitOnError=0 | boolean | If set, then the function will exit with an error message. |
Returns: | integer | The page UID of a page in the rootline that matched a mount point |
Checks access to a backend module with the $MCONF passed as first argument
$conf | array | $MCONF array of a backend module! |
$exitOnError | boolean | If set, an array will issue an error message and exit. |
Returns: | boolean | Will return true if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return false if the module name is not even found in $TBE_MODULES |
Returns a WHERE-clause for the pages-table where user permissions according to input argument, $perms, is validated.
$perms is the 'mask' used to select. Fx. if $perms is 1 then you'll get all pages that a user can actually see!
2^0 = show (1)
2^1 = edit (2)
2^2 = delete (4)
2^3 = new (8)
If the user is 'admin' " 1=1" is returned (no effect)
If the user is not set at all (->user is not an array), then " 1=0" is returned (will cause no selection results at all)
The 95% use of this function is "->getPagePermsClause(1)" which will
return WHERE clauses for *selecting* pages in backend listings - in
other words will this check read permissions.
$perms | integer | Permission mask to use, see function description |
Returns: | string | Part of where clause. Prefix " AND " to this. |
Returns a combined binary representation of the current users permissions for the page-record, $row.
The perms for user, group and everybody is OR'ed together (provided
that the page-owner is the user and for the groups that the user is a
member of the group
If the user is admin, 31 is returned (full permissions for all five flags)
$row | array | Input page row with all perms_* fields available. |
Returns: | integer | Bitwise representation of the users permissions in relation to input page row, $row |
Returns true if the RTE (Rich Text Editor) can be enabled for the user
Strictly this is not permissions being checked but rather a series of
settings like a loaded extension, browser/client type and a
configuration option in ->uc[edit_RTE]
Returns: | boolean |
Returns true if the $value is found in the list in a $this->groupData[] index pointed to by $type (array key).
Can thus be users to check for modules, exclude-fields, select/modify permissions for tables etc.
If user is admin true is also returned
Please see the document Inside TYPO3 for examples.
$type | string | The type value; "webmounts", "filemounts", "pagetypes_select", "tables_select", "tables_modify", "non_exclude_fields", "modules" |
$value | string | String to search for in the groupData-list |
Returns: | boolean | True if permission is granted (that is, the value was found in the groupData list - or the BE_USER is "admin") |
Will check a type of permission against the compiled permission integer, $lCP, and in relation to table, $table
$lCP | integer | $lCP could typically be the "compiled permissions" integer returned by ->calcPerms |
$table | string | $table is the tablename to check: If "pages" table then edit,new,delete and editcontent permissions can be checked. Other tables will be checked for "editcontent" only (and $type will be ignored) |
$type='' | string | For $table='pages' this can be 'edit' (2), 'new' (8 or 16), 'delete' (4), 'editcontent' (16). For all other tables this is ignored. (16 is used) |
Returns: | boolean |
Returns true if the BE_USER is allowed to *create* shortcuts in the backend modules
Returns: | boolean |
Returns the value/properties of a TS-object as given by $objectString, eg. 'options.dontMountAdminMounts'
Nice (general!) function for returning a part of a TypoScript array!
$objectString | string | Pointer to an "object" in the TypoScript array, fx. 'options.dontMountAdminMounts' |
$config='' | array | Optional TSconfig array: If array, then this is used and not $this->userTS. If not array, $this->userTS is used. |
Returns: | array | An array with two keys, "value" and "properties" where "value" is a string with the value of the objectsting and "properties" is an array with the properties of the objectstring. |
@params array An array with the TypoScript where the $objectString is located. If this argument is not an array, then internal ->userTS (User TSconfig for the current BE_USER) will be used instead. |
Returns the "value" of the $objectString from the BE_USERS "User TSconfig" array
$objectString | string | Object string, eg. "somestring.someproperty.somesubproperty" |
Returns: | string | The value for that object string (object path) |
@see getTSConfig() |
Returns the "properties" of the $objectString from the BE_USERS "User TSconfig" array
$objectString | string | Object string, eg. "somestring.someproperty.somesubproperty" |
Returns: | array | The properties for that object string (object path) - if any |
@see getTSConfig() |
Returns true if $item is in $in_list
$in_list | string | Comma list with items, no spaces between items! |
$item | string | The string to find in the list of items |
Returns: | string | Boolean |
Returns an array with the webmounts.
If no webmounts, and empty array is returned.
Returns: | array |
Returns an array with the filemounts for the user. Each filemount is represented with an array of a "name", "path" and "type".
If no filemounts an empty array is returned.
Returns: | array |
Initializes a lot of stuff like the access-lists, database-mountpoints and filemountpoints
This method is called by ->backendCheckLogin() (from extending class
t3lib_beuserauth) if the backend user login has verified OK.
Returns: | void | |
@see t3lib_TSparser |
Fetches the group records, subgroups and fills internal arrays.
Function is called recursively to fetch subgroups
$grList | string | Commalist of be_groups uid numbers |
$idList='' | string | List of already processed be_groups-uids so the function will not fall into a eternal recursion. |
Returns: | void |
Updates the field be_users.usergroup_cached_list if the groupList of the user has changed/is different from the current list.
The field "usergroup_cached_list" contains the list of groups which the
user is a member of. After authentication (where these functions are
called...) one can depend on this list being a representation of the
exact groups/subgroups which the BE_USER has membership with.
$cList | string | The newly compiled group-list which must be compared with the current list in the user record and possibly stored if a difference is detected. |
Returns: | void |
Adds
a filemount to the users array of filemounts,
$this->groupData['filemounts'][hash_key] = Array ('name'=>$name,
'path'=>$path, 'type'=>$type);
Is a part of the authentication proces of the user.
A final requirement for a path being mounted is that a) it MUST return
true on is_dir(), b) must contain either PATH_site+'fileadminDir' OR
'lockRootPath' - if lockRootPath is set - as first part of string!
Paths in the mounted information will always be absolute and have a trailing slash.
$title | string | $title will be the (root)name of the filemount in the folder tree |
$altTitle | string | $altTitle will be the (root)name of the filemount IF $title is not true (blank or zero) |
$path | string | $path is the path which should be mounted. Will accept backslash in paths on windows servers (will substituted with forward slash). The path should be 1) relative to TYPO3_CONF_VARS[BE][fileadminDir] if $webspace is set, otherwise absolute. |
$webspace | boolean | If $webspace is set, the $path is relative to 'fileadminDir' in TYPO3_CONF_VARS, otherwise $path is absolute. 'fileadminDir' must be set to allow mounting of relative paths. |
$type | string | Type of filemount; Can be blank (regular) or "user" / "group" (for user and group filemounts presumably). Probably sets the icon first and foremost. |
Returns: | boolean | Returns "1" if the requested filemount was mounted, otherwise no return value. |
Creates a TypoScript comment with the string text inside.
$str | string | The text to wrap in comment prefixes and delimiters. |
Returns: | string | TypoScript comment with the string text inside. |
Writes an entry in the logfile
... Still missing documentation for syntax etc...
$type | integer | $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent |
$action | integer | $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!) |
$error | integer | $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin) |
$details_nr | integer | $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages |
$details | string | $details: Default text that follows the message |
$data | array | $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text... |
$tablename='' | string | $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
$recuid='' | integer | $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
$recpid='' | integer | $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.) |
$event_pid=-1 | integer | $event_pid: The page_uid (pid) where the event occurred. Used to select log-content for specific pages. |
$NEWid='' | string | $NEWid: NEWid string |
Returns: | void |
Sends a warning to $email if there has been a certain amount of failed logins during a period.
If a login fails, this function is called. It will look up the sys_log
to see if there has been more than $max failed logins the last
$secondsBack seconds (default 3600). If so, an email with a warning is
sent to $email.
string | Email address | |
$secondsBack=3600 | integer | Number of sections back in time to check. This is a kind of limit for how many failures an hour for instance. |
$max=3 | integer | Max allowed failures before a warning mail is sent |
Returns: | void |
XML class, Used to create XML output from input rows.
Doesn't contain a lot of advanced features - pretty straight forward, practical stuff
You are encouraged to use this class in your own applications.
Filesize: | 9.7 K |
Func/Classes: | 18 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib @see user_xmlversion, user_wapversion |
XML class, Used to create XML output from input rows.
Doesn't contain a lot of advanced features - pretty straight forward, practical stuff
You are encouraged to use this class in your own applications.
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib | ||
@see user_xmlversion, user_wapversion |
Constructor, setting topLevelName to the input var
$topLevelName | string | Top Level Name |
Returns: | void |
When outputting a input record in XML only fields listed in $this->XML_recFields for the current table will be rendered.
$table | string | Table name |
$list | string | Commalist of fields names from the table, $table, which is supposed to be rendered in the XML output. If a field is not in this list, it is not rendered. |
Returns: | void |
Returns the result of the XML rendering, basically this is imploding the internal ->lines array with linebreaks.
Returns: | string |
Initialize WML (WAP) document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level.
Returns: | void |
Initialize "anonymous" XML document with <?xml + <!DOCTYPE header tags and setting ->topLevelName as the first level.
Encoding is set to UTF-8!
Returns: | void |
Indents/Outdents a new level named, $name
$name | string | The name of the new element for this level |
$beginEndFlag=0 | boolean | If false, then this function call will *end* the level, otherwise create it. |
$params=array() | array | Array of attributes in key/value pairs which will be added to the element (tag), $name |
Returns: | void |
Function that will return the content from string $content. If the internal ->XMLdebug flag is set the content returned will be formatted in <pre>-tags
$content | string | The XML content to output |
Returns: | string | Output |
Increments/Decrements Indentation counter, ->XMLIndent
Sets and returns ->Icode variable which is a line prefix consisting
of a number of tab-chars corresponding to the indent-levels of the
current posision (->XMLindent)
$b | boolean | If true the XMLIndent var is increased, otherwise decreased |
Returns: | string | ->Icode - the prefix string with TAB-chars. |
Takes a SQL result for $table and traverses it, adding rows
$table | string | Tablename |
$res | pointer | SQL resource pointer, should be reset |
Returns: | void |
Adds record, $row, from table, $table, to the internal array of XML-lines
$table | string | Table name |
$row | array | The row to add to XML structure from the table name |
Returns: | void |
Internal function for adding the actual content of the $row from $table to the internal structure.
Notice that only fields from $table that are listed in
$this->XML_recFields[$table] (set by setRecFields()) will be
rendered (and in the order found in that array!)
Content from the row will be htmlspecialchar()'ed, UTF-8 encoded and
have chr(10) (newlines) exchanged for '<newline/>' tags. The
element name for a value equals the fieldname from the record.
$table | string | Table name |
$row | array | Row from table to add. |
Returns: | void |
UTF-8 encodes the input content (from ISO-8859-1!)
$content | string | String content to UTF-8 encode |
Returns: | string | Encoded content. |
Substitutes chr(10) characters with a '<newline/>' tag.
$string | string | Input value |
Returns: | string | Processed input value |
Wraps the value in tags with element name, $field.
$field | string | Fieldname from a record - will be the element name |
$value | string | Value from the field - will be wrapped in the elements. |
Returns: | string | The wrapped string. |
Add a line to the internal XML structure (automatically prefixed with ->Icode.
$str | string | Line to add to the $this->lines array |
Returns: | void |
Class for generating a thumbnail from the input parameters given to the script
Input GET var, &file: relative or absolute reference to an imagefile. WILL be validated against PATH_site / lockRootPath
Input GET var, &size: integer-values defining size of thumbnail, format '[int]' or '[int]x[int]'
Relative paths MUST BE the first two characters ONLY: eg: '../dir/file.gif', otherwise it is expect to be absolute
Filesize: | 12.4 K |
Func/Classes: | 6 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage t3lib |
Class for generating a thumbnail from the input parameters given to the script
Input GET var, &file: relative or absolute reference to an imagefile. WILL be validated against PATH_site / lockRootPath
Input GET var, &size: integer-values defining size of thumbnail, format '[int]' or '[int]x[int]'
Relative paths MUST BE the first two characters ONLY: eg: '../dir/file.gif', otherwise it is expect to be absolute
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage t3lib |
Initialize; reading parameters with GPvar and checking file path
Results in internal var, $this->input, being set to the absolute path of the file for which to make the thumbnail.
Returns: | void |
Creates error image based on gfx/notfound_thumb.png
Requires GD lib enabled, otherwise it will exit with the three textstrings outputted as text.
Outputs the image stream to browser and exits!
$l1 | string | Text line 1 |
$l2 | string | Text line 2 |
$l3 | string | Text line 3 |
Returns: | void |
Creates a font-preview thumbnail.
This means a PNG/GIF file with the text "AaBbCc...." set with the
font-file given as input and in various sizes to show how the font looks
Requires GD lib enabled.
Outputs the image stream to browser and exits!
$font | string | The filepath to the font file (absolute, probably) |
Returns: | void |
Wrapping the input filename in double-quotes
$inputName | string | Input filename |
Returns: | string | The output wrapped in "" (if there are spaces in the filepath) |