GetParameter('url'); if (empty($url) && isset($this->config['source_url']) && !empty($this->config['source_url'])) { $url = $this->config['source_url']; } if (!empty($url)) { // parameter of this action $champ = $this->GetParameter('champ'); $image = $this->GetParameter('image'); $texte = $this->GetParameter('texte'); $defaut = $this->GetParameter('defaut'); if (!empty($champ)) { // on harge dans une variable globale pour le cas ou l'action est appelée plusieurs fois if (!isset($GLOBALS['externalpage'][$url])) { $GLOBALS['externalpage'][$url] = file_get_contents($url.'/html'); } if (!$GLOBALS['externalpage'][$url] === false) { // le titre est un cas particulier if ($champ == 'bf_titre') { $regexp = '/

(.*)<\/h1>/Uis'; } elseif ($champ == 'id_fiche') { // l'id est un cas particulier $urlparsed = parse_url($url); echo preg_replace('/(.*?)wiki=(.*?)/Ui', '$2', $urlparsed['query']); return; } elseif (!empty($image) && ($image == 'lien' || $image == '1')) { // cas des images $regexp = '/\s*/Uis'; } else { $regexp = '/\s*.*\s*\s*(.*)\s*<\/span>/Uis'; } preg_match_all($regexp, $GLOBALS['externalpage'][$url], $matches); if (isset($matches[1]) && count($matches[1]) > 0) { if (!empty($texte) && $texte != 'lien') { echo preg_replace('/.*<\/a>/Ui', ''.trim($texte).'', trim(array_shift($matches[1]))); } elseif (!empty($texte) && $texte == 'lien') { echo preg_replace('/.*<\/a>/Ui', '$1', array_shift($matches[1])); } elseif ($image == '1') { echo 'image '.$champ.''; } else { echo trim(array_shift($matches[1])); } } else { if (isset($defaut) && !empty($defaut)) { echo $defaut; } } } else { echo '
'._t('BAZAR_ACTION_VALEUR').' : '._t('BAZAR_URL_ERROR').' : '.$url.'.
'."\n"; } } else { echo '
'._t('BAZAR_ACTION_VALEUR').' : '._t('BAZAR_PARAM_CHAMP_REQUIRED').'.
'."\n"; } } else { echo '
'._t('BAZAR_ACTION_VALEUR').' : '._t('BAZAR_PARAM_URL_REQUIRED').'.
'."\n"; }