Skip to content
Snippets Groups Projects
Commit eeb0ede4 authored by Laurent's avatar Laurent
Browse files

Merge branch...

Merge branch 'hotline#117624_magasin_de_themes_reprise_des_vignettes_articles_sur_facebook' into 'hotline'

hotline#117624 : social network : post on facebook now includes image

See merge request !3796
parents 5de5dc09 a50105e2
Branches
Tags
2 merge requests!3797Hotline,!3796hotline#117624 : social network : post on facebook now includes image
Pipeline #12044 passed with stage
in 54 minutes and 11 seconds
- ticket #117624 : Reprise des images d'articles sur les posts Facebook
\ No newline at end of file
......@@ -37,17 +37,21 @@ class ZendAfi_View_Helper_ShareUrl extends Zend_View_Helper_HtmlElement {
public function shareUrl($id_reseau,$url_afi,$titre= '', $message = '', $url_img = '') {
$url_afi = $this->view->absoluteUrl(urldecode($url_afi));
if ($url_img && false === strpos($url_img,'http'))
$url_img = $this->view->absoluteUrl(urldecode($url_img));
return $id_reseau === 'facebook'
? $this->getFacebookUrl($url_afi, $titre)
? $this->getFacebookUrl($url_afi, $titre, $url_img)
: $this->getTwitterUrl($url_afi,
$titre,
$message);
}
public function getFacebookUrl($url, $titre) {
public function getFacebookUrl($url, $titre, $url_img) {
return $this->reseaux['facebook']['url'] . '?' . http_build_query(['u' => $url,
'title' => $titre]);
'title' => $titre,
'img_url' => $url_img]);
}
......
......@@ -29,4 +29,13 @@ class SocialNetworkControllerShareActionTest extends AbstractControllerTestCase
$this->assertEquals("window.open('https://twitter.com/share?url=http%3A%2F%2Fwww.institut-francais.com&text=Vive+bucarest+%21&counturl=http%3A%2F%2Fwww.institut-francais.com','_blank','toolbar=0,status=0,width=800, height=410');",
$this->_response->getBody());
}
/** @test */
public function shareOnFacebookShouldInjectAllRequestedInformation() {
$this->dispatch('/social-network/share/on/facebook/url/'.urlencode('http://www.institut-francais.com').'/titre/'.urlencode('Vive bucarest !').'/img_url/'.urlencode('http://www.institut-francais.com/image/BIG.jpg'), true);
$this->assertEquals("window.open('https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.institut-francais.com&title=Vive+bucarest+%21&img_url=http%3A%2F%2Fwww.institut-francais.com%2Fimage%2FBIG.jpg','_blank','toolbar=0,status=0,width=800, height=410');",
$this->_response->getBody());
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment