Bonjour à tous,
Je possède un blog perso Wordpress sur lequel je partage mes photos.
J'utilise un plugin (flickr-manager) qui va chercher mes photos sur mon compte flickr et qui me les rapatrie par album sous forme de miniatures.
de temps à autres, j'ai cette erreur:
Warning: Invalid argument supplied for foreach() in /mnt/142/sda/7/3/gaetan.besson/wp-content/plugins/wordpress-flickr-manager/FlickrManager.php on line 832
et l'album ne s'affiche pas.
Je suis a peu près sûr que c'est dû à une erreur de connection avec flickr puisque l'erreur en question est aléatoire, peut concerner n'importe quel album, et disparait généralement lorsque j'actualise ma page avec F5...
cependant, je ne connait absolument rien en langage de programmation et encore moins en php. J'aimerais donc votre aide pour arriver à créer une sorte de boucle pour que tant que l'erreur a lieu, la fonction soit relancée (j'espère être clair).
Voici la fonction en question sur le Flickrmanager.php: (la ligne 832 est celle où il y a "foreach ($photoset['photoset']['photo'] as $photo) {" )
function set_shortcode($attr) {
global $flickr_settings;
$token = $flickr_settings->getSetting('token');
$params = array('photoset_id' => $attr['id'], 'auth_token' => $token, 'extras' => 'original_format');
if($flickr_settings->getSetting('privacy_filter') == 'true') $params = array_merge($params, array('privacy_filter' => 1));
$photoset = $this->call('flickr.photosets.getPhotos',$params, true);
$html = '';
foreach ($photoset['photoset']['photo'] as $photo) {
$html .= $flickr_settings->getSetting('before_wrap') . "<a href=\"http://www.flickr.com/photos/{$photoset['photoset']['owner']}/{$photo['id']}/\" title=\"{$photo['title']}\" ";
if($attr['overlay'] == 'true') $html .= "rel=\"flickr-mgr[{$attr['id']}]\" ";
$html .= "class=\"flickr-image\" >\n";
$html .= ' <img src="' . $this->getPhotoUrl($photo, $attr['thumbnail']) . "\" alt=\"{$photo['title']}\" ";
if($attr['overlay'] == 'true') $html .= "class=\"flickr-{$attr['size']}\" ";
if($attr['size'] == 'original') $html .= 'longdesc="' . $this->getPhotoUrl($photo, 'original') . '" ';
$html .= "/>\n</a>\n" . $flickr_settings->getSetting('after_wrap');;
}
return $html;
}
Merci d'avance