Fixes some errors in shortcodes functions

parent 8ee92f19
<?php
if (!defined('FLICKR_API_KEY'))
define('FLICKR_API_KEY','4197236ed82c48d3271fb72ca2c7923c');
define('FLICKR_API_KEY','');
if (!defined('FLICKR_API_SECRET'))
define('FLICKR_API_SECRET','3a6a468e58118091');
define('FLICKR_API_SECRET','');
// to get flickr user id
// https://www.webfx.com/tools/idgettr/
if (!defined('FLICKR_USERID'))
define('FLICKR_USERID','32796764@N08');
define('FLICKR_USERID','');
if (!defined('FLICKR_USERNAME'))
define('FLICKR_USERNAME','');
if (!defined('FLICKR_SET1'))
define('FLICKR_SET1','72157626186253384'); // food photoset
define('FLICKR_SET1','');
if (!defined('FLICKR_SET2'))
define('FLICKR_SET2','72157662442917857'); // humanity heritage
define('FLICKR_SET2','');
if (!defined('FLICKR_SET2'))
define('FLICKR_SET2','72157662441726607'); // the river
if (!defined('FLICKR_SET3'))
define('FLICKR_SET3','');
?>
......@@ -18,7 +18,7 @@ include('flickr.config.php');
// CSV data file vars
$csv = array(
'filename' => plugin_basename( dirname( __FILE__ ) ) . '/content/testimonies.csv',
'filename' => plugins_url() .'/'. plugin_basename( dirname( __FILE__ ) ) . '/content/testimonies.csv',
'line_length' => "1024", // max line lengh (increase in case you have longer lines than 1024 characters)
'delimiter' => ",", // field delimiter character
'enclosure' => '"' // field enclosure character
......@@ -27,11 +27,11 @@ $csv = array(
function turismomal_get_photoset_photo($photosets = array(FLICKR_SET1, FLICKR_SET2, FLICKR_SET3),$size = 'b') {
// $size can be s (75x75), m (240px), z (640px), b (full)
$photoset = array_rand($photosets);
$photoset = $photosets[array_rand($photosets)];
$url = "https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=".FLICKR_API_KEY."&photoset_id=".$photoset."&user_id=".FLICKR_USERID."&format=json&nojsoncallback=1";
$response = json_decode(file_get_contents($url));
$photos = $response->photoset->photo;
$photo = array_rand($photos);
$photo = $photos[array_rand($photos)];
$photo_url = "https://farm".$photo->farm.".staticflickr.com/".$photo->server."/".$photo->id."_".$photo->secret."_".$size.".jpg";
$photo_out = "<img src='".$photo_url."' alt='".$photo->title."' />";
return $photo_out;
......@@ -54,12 +54,13 @@ function turismomal_get_testimony() {
$count++;
if ( $count == 1 )
continue;
$data[] = $fp_csv[0];
}
fclose($fp); // close file pointer
$line = array_rand($data);
$line = $data[array_rand($data)];
return $line;
}
else {
......
Markdown is supported
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