Earn cash with Phocagallery download feature

Phoca Gallery - image gallery extension
nordmograph
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 04 Jun 2011, 19:34

Earn cash with Phocagallery download feature

Post by nordmograph »

Hi

I just wanted to share a little mod that a customer asked me to integrate:
He wanted to earn cash from people downloading his site's phocaGallery images.
This is possible with AdFly url shortener and ad service API

Here is how to proceed

1. Get a adf.ly/?id=8726147 (free AdFly Account)
2. From your account, get a the API key and your UID

Here is the modification for the DIRECT DOWNLOAD button type on category view
Open this file:
components/com_phocagallery/views/category/tmpl/default_images.php
find :
// Direct Download but not if there is a youtube

Right below it add:

Code: Select all

$key                = 'cfea8b20afcad652f6608d1e88ed08b6'; 
$uid                = '8726147'; 
$url =  JURI::Root().'index.php?option=com_phocagallery&view=detail&catid='.$cv->catslug.'&id='.$cv->slug. $this->tmpl['tmplcom'].'&phocadownload='.$cv->display_icon_download.'&Itemid='. $this->itemId ;
$api = 'http://api.adf.ly/api.php?'; 
$api .= 'key='.$key; 
$api .= '&uid='.$uid; 
$api .= '&advert_type=int'; 
$api .= '&domain=adf.ly'; 
$api .= '&url='.urlencode($url); 
if ($data = file_get_contents($api) ) 
	$url = $data;
Then in the 2 following a tags href attribute, replace

Code: Select all

JRoute::_('index.php?option=com_phocagallery&view=detail&catid='.$cv->catslug.'&id='.$cv->slug. $this->tmpl['tmplcom'].'&phocadownload='.$cv->display_icon_download.'&Itemid='. $this->itemId )
with

Code: Select all

$url
:twisted: Et voila !
Of course you must replace the API key ($key) and UID ($uid) variabes values is yours