[Typo3-dev] Deny field list

Mathias Schreiber [wmdb] mathias.schreiber at wmdb.de
Sat Dec 18 14:19:04 CET 2004


Lars Houmark wrote:
>>I will now follow my first approach and do a fully working example and 
>>supply it as soon as I'm finished.

done :) man I love PHP. Simply compare anything with anything and it 
works... Rambo style coding :)

> OK then, I'm not to do any further then, and hope to see a patch for the 
> next release. If you need any testing, then please email me the patch, and I 
> will test it ;)

I have a last question on a topic that is not really covered by the CGL:
I regex a bit to get the value and then write them to an array to 
compare it against the denyfields.

---------------- CODE ---------------------
unset($checkArray);
$ctypeString = ereg_replace(".*\[tt_content\]\[CType\]=", "", 
$item['params']);
$ctype = ereg_replace("\&.*", "", $ctypeString);
// maybe do this shorter soon
$checkArray['CType'] = $ctype;
// Check if a List Type is set at all
if (strstr($item['params'],'[CType]=list')) {
	$list_typeString = ereg_replace(".*\[tt_content\]\[list_type\]=", "", 
$item['params']);
	$list_type = ereg_replace("\&.*", "", $list_typeString);
	// Maybe do this shorter soon.
	$checkArray['list_type'] = $list_type;
}
---------------- CODE ---------------------

I could also directly assign the vars to $checkArray by writing a rather 
long line of code:

---------------- CODE ---------------------
unset($checkArray);
$checkArray['CType'] = $ctype = ereg_replace("\&.*", 
"",ereg_replace(".*\[tt_content\]\[CType\]=", "", $item['params']));
// Check if a List Type is set at all
if (strstr($item['params'],'[CType]=list')) {
	$checkArray['list_type'] = ereg_replace("\&.*", "", 
ereg_replace(".*\[tt_content\]\[list_type\]=", "", $item['params']));
}
---------------- CODE ---------------------

less lines but harder to ready.
I might save some bytes of RAM here due to not assigning stuff over and 
over again but I am not sure if the benefit over readability of code 
makes sense.
What do you guys think?

However - the patch is done :)

-- 
No Subject - No Realname - No Service!
Respect the List/Newsgroup Rules!
  >> http://typo3.org/1438.0.html <<




More information about the TYPO3-dev mailing list