{{indexmenu_n>200}} ====== CP´s text w/image, images, images
===== Description: =====
**Example: CP images**
{{:english:phpwcms_replacer_rts:frontend_init:cp_trigger:cp_image_be_en.snag_1.gif|}}
- **In caption** may not be entered a alt-tag, so that RT can work properly.
/spezial)
* In der Bildunterzeile: Bildunterzeile|||Titel
* Tag im CP Notizfeld: [XIMAGES_INFO] -> Nur zur Identifikation "Ist das der richtige CP"
* Using image infos from file center in alt tag of the images in cp image//special
* Tag in CP notes field: [XIMAGES_INFO] -> Only for identification "is this the right CP"
* In CP in caption: Caption-Text|||Title-Text
*
**********************************************************************************************
*/
function TRIGG_CP_IMAGE_READ_FILECENTER_V10($text, & $data) {
// Der richtige CP: Text/wImage /1) / images (2) / image (29) / image special (31)
// and Tag available?
if ( $data['acontent_type'] == 1 OR // cp image/text
$data['acontent_type'] == 2 OR // cp images
$data['acontent_type'] == 29 OR // cp image
$data['acontent_type'] == 31 AND // cp image special
(strpos($data['acontent_comment'], '[XIMAGES_INFO]') !== false) // TAG is set ? // TAG vorhanden?
)
{
// ===CUSTOM var ========================================================
// Put in the right string ------
$replace_alt = 'f_shortinfo'; // default = 'f_shortinfo'
// 'DB feld' -> Eingabefeld in der Dateizentrale
// 'DB field' -> input field in file center
// +--------------+----------------------------------------------------+
// 'f_shortinfo' -> keywords: additional: // Keywords: Zusätzlich:
// 'f_longinfo' -> long info: // Info:
// 'f_copyright' -> copyright: // Copyright
// 'f_tags' -> tags: // Tag/Schlagwort:
// +--------------+----------------------------------------------------+
// ===END CUSTOM var ====================================================
// alle file IDs holen wenn vorhanden direkt aus dem serialiserten String // i:0;s:2:"22";
// catch all file IDs if available from the serialized string
if ($data['acontent_type'] == 1) { // cp image/text
preg_match_all('/^(\d*?):/',$data['acontent_image'], $fileID);
} else // all other image cp´s
preg_match_all('/i:0;s:2:"(.*?)";/',$data['acontent_form'], $fileID);
// Irgendetwas verwertbares vorhanden?
// Is there any content available?
if (!empty ($fileID[0])) {
// Read the file entries from database
// -----------------------------------
$ids = join("','", $fileID[1]);
$sql = 'SELECT * ';
$sql .= 'FROM '.DB_PREPEND.'phpwcms_file ';
$sql .= "WHERE f_id IN ('$ids')";
$db_data = _dbQuery($sql);
// -----------------------------------
// Inhalt aus DB verfuegbar?
// Is there any content from db available?
if(isset($db_data[0])) {
$search = '';
$replace = '';
// Daten holen und ersetzen
// Catch data from db and replace in text
foreach($fileID[1] as $key=>$value0) {
foreach($db_data as $key1=>$value1)
if ($value1['f_id'] == $value0) {
$search = $value1['f_name'];
$replace = $value1[$replace_alt];
break;
}
// Replace in alt tag: file name to text from file center
$text = preg_replace('/alt="'.$search.'"/i', 'alt="'.$replace.'"', $text, 1);
} // ----- END foreach
} // ------ END isset($db_data[0]
}
}
return $text;
}
register_cp_trigger('TRIGG_CP_IMAGE_READ_FILECENTER_V10');
?>
\\