forked from cs2ag/powermail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/powermail/trunk@60493 735d13b6-9817-0410-8766-e36946ffe9aa
- Loading branch information
wunschtacho
committed
Apr 8, 2012
1 parent
c7d80fc
commit 0107e4e
Showing
5 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2012 Alex Kellner <[email protected]>, in2code.de | ||
* | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
|
||
/** | ||
* Class to extend Pi1 field marker e.g. {firstname} | ||
* | ||
* @package powermail | ||
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later | ||
* | ||
*/ | ||
class Tx_Powermail_Utility_InitialMarker { | ||
|
||
/** | ||
* Initialy filling of marker field | ||
* | ||
* @param string $status mode of change | ||
* @param string $table the table which gets changed | ||
* @param string $id uid of the record | ||
* @param array $fieldArray the updateArray | ||
* @param array $this obj | ||
* @return an updated fieldArray() | ||
*/ | ||
public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { | ||
if ($table != 'tx_powermail_domain_model_fields') { // stop if not powermail field table | ||
return $fieldArray; | ||
} | ||
if (!empty($fieldArray['marker'])) { // stop if marker field is already filled | ||
return $fieldArray; | ||
} | ||
$fieldArray['marker'] = $this->cleanString($fieldArray['title']); | ||
} | ||
|
||
/** | ||
* Clean Marker String ("My Field" => "my_field") | ||
* | ||
* @param string $string Any String | ||
* @return string | ||
*/ | ||
private function cleanString($string) { | ||
$string = preg_replace('/[^a-zA-Z0-9_-]/', '', $string); | ||
$string = str_replace(array('-'), '_', $string); | ||
$string = strtolower($string); | ||
return $string; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters