Sostituire & con &

6 contenuti / 0 new
Ultimo contenuto
Sostituire & con &

Abbiamo installato il modulo video per drupal 6.
Abbiamo creato un nuodo video inserendo un url di youtube.
Il validatore del w3c mi segnala errore sulla e commerciale.

In pratica bisognerebbe sostituire & con & qui:
param name="movie" value="http://www.youtube.com/v/ivDWyM6vK6I&rel=0"
sostituendo con:
param name="movie" value="http://www.youtube.com/v/ivDWyM6vK6I&rel=0"

Come possiamo fare?

Mi sembra un problema del modulo...

dany wrote:
Ho installato il modulo video per drupal 6.
Ho creato un nuodo video inserendo un url di youtube.
Il validatore del w3c mi segnala errore sulla e commerciale.

In pratica bisognerebbe sostituire & con & qui:
param name="movie" value="http://www.youtube.com/v/ivDWyM6vK6I&rel=0"
sostituendo con:
param name="movie" value="http://www.youtube.com/v/ivDWyM6vK6I&rel=0"

Come posso fare?

Prima, prova dare l'URL modificato http://www.youtube.com/v/ivDWyM6vK6I&rel=0[/codefilter_code] al modulo per vedere se questo risolve il problema.
Modifcato: Pensando bene, questo è un URL, quindi puoi sostituire & con %26:
http://www.youtube.com/v/ivDWyM6vK6I%26rel=0[/codefilter_code] che forse è meglio.

In ogni caso, sarebbe da segnalare, perchè il modulo dovrebbe usare la funzione check_plain su un attributo. Forse qualcuno ha già registrato un issue...

HTH

John

Più imparo, più dubito.

Sostituire & con &+amp;
Mi spiego meglio:
Per la pubblicazione di un video di youtube con il modulo video per Drupal 6 inserisco nel campo URL l'indirizzo che mi dà youtube, tipo http://www.youtube.com/watch?v=0Q2aPi9ZEgs
Il nodo viene pubblicato e funziona correttamente, solo che c'è un errore nel codice XHTML:
nel codice compare una strunga tipo questa:
param name="movie" value="http://www.youtube.com/v/ivDWyM6vK6I&rel=0"
che è scorretta.

Se non ho capito male bisogna sostituire "&" con "& +amp;"

Ho lo stesso problema.
Penso di aver trovato dove bisogna correggere.

/**
* implementation of hook_v_validate
*/
function video_youtube_v_validate($node) {
  if(!preg_match("/^http:\/\/([a-z]{2,3}\.)?youtube\.com\/watch\?v=/", $node->vidfile)) {
    form_set_error('vidfile', t('The Youtube Video URL field must be similar to <em>http://youtube.com/watch?v=IICWFx7sKmw</em>, <em>http://www.youtube.com/watch?v=IICWFx7sKmw</em> or <em>http://it.youtube.com/watch?v=IICWFx7sKmw</em>'));
  }
  else if(variable_get('video_youtube_validation', false)){
    // we have a good URL. Let's check that the video is available on Youtube and that it is embeddable.
    // the approach used here is to return errors only if Youtube explicitely says "an error has occurred"
    $id = _video_youtube_get_id($node->vidfile);
    // jlampton changed the youtube validation url
    $response = _video_apiclient_youtube_request('gdata.youtube.com/feeds/api/videos', array('video_id' => $id));
    if(isset($response['ERROR'])) {
      form_set_error('vidfile', t('The Youtube Video URL validation has failed for some reason. Please check the URL and try again.<br />If the error persists please contact %site_name administrators.', array('%site_name' => variable_get('site_name', 'Drupal'))));
      if(isset($response['ERROR']['DESCRIPTION'][0])) {
        drupal_set_message(t('The Youtube validation service reported the following error: %error', array('%error'=>$response['ERROR']['DESCRIPTION'][0])), 'error');
      }
    }
    else if(isset($response['VIDEO_DETAILS']['EMBED_STATUS'][0])
    && $response['VIDEO_DETAILS']['EMBED_STATUS'][0] != 'ok') {
      // embedding has been disabled. we let the video pass but we warn the user
      drupal_set_message(t('The video authors have disabled embedding on Youtube. This means that this video will only be playable directly on Youtube.'));
    }
    else { // if youtube did not explicetely said "an error has occurred" we accept the video
      ;
    }
  }
}

In pratica l'URL dato da Youtube è http://www.youtube.com/watch?v=ivDWyM6vK6I.
Occorre far capire a Drupal che andrebbe riscritto così:
http://www.youtube.com/watch/v/ivDWyM6vK6I

Qualcuno ci può aiutare?

OK, ho risolto.
In Video/types/video_youtube
riga 285/287

<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'"
data="http://www.youtube.com/v/' . $id . '&rel='.$rel.'">
<!--> <![endif]-->' . "\n";

sostituire con
<object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'"
data="http://www.youtube.com/v/' . $id . '&amp;rel='.$rel.'">
<!--> <![endif]-->' . "\n";

riga 297
$output .= '<param name="movie" value="http://www.youtube.com/v/' . $id . '&rel='.$rel.'" />' . "\n"

sostituire con
$output .= '<param name="movie" value="http://www.youtube.com/v/' . $id . '&amp;rel='.$rel.'" />' . "\n"

Sei grande!!!!!!