Please select a page:
- About Us
- Advertising Rates
- Recommended Links
- Dog Show Terminology
- Overseas Exhibitors
- Terms and Conditions
- Privacy Policy
« Home
Contact Us!
If you need to contact us at Higham Press, please Email:
admin@dog.biz
'',
'tweet' => ' $linkObj)
{
$link = "";
$label = "";
$rem = "";
if($linkObj->text){
$link = $linkObj->text;
$label = "#".$link;
$rem = "#";
}
$screen_name = '';
if($linkObj->screen_name){
$link = $linkObj->screen_name;
$label = "@".$link;
$rem = "@";
}
if($linkObj->display_url){
$link = $linkObj->url;
$label = $linkObj->display_url;
}
$linktxt = preg_replace("/{link}/",$link,$template);
$linktxt = preg_replace("/{label}/",$label,$linktxt);
$text = substr_replace($text,$linktxt,strpos($text,$rem.$link),strlen($rem.$link));
}
}
return $text;
}
public function getTweetFeed($tweetCount,$latesttweetid){
$twitterData = array();
$twitterData['url'] = ($latesttweetid != null)?"https://api.twitter.com/1.1/statuses/oembed.json":"https://api.twitter.com/1.1/statuses/user_timeline.json";
$tweetAuth = array("screen_name" => "highampress",
"id" => $latesttweetid,
"count" => $tweetCount,
"oauth_consumer_key" => "AXVKFUpve9utRDGik5zS6Q",
"oauth_nonce" => $this->getRandomString(),
"oauth_signature_method" => "HMAC-SHA1",
"oauth_timestamp" => time(),
"oauth_token" => "104785062-YijuyiQpf2q59FKg64oxWhyNggARGL4fedVfuBuA",
"oauth_version" => "1.0"
);
$tweetAuth['oauth_signature'] = $this->getOauthSig($tweetAuth,"get",$twitterData['url'],$latesttweetid);
ksort($tweetAuth);
$tweetAuthStr = 'OAuth ';
foreach($tweetAuth as $tKey => $tVal)
{
if($tKey != "screen_name" && $tKey != "count" && $tKey != "id")$tweetAuthStr .= rawurlencode($tKey).'="'.rawurlencode($tVal).'", ';
}
$tweetAuthStr = substr($tweetAuthStr,0,-2);
$tweeturlappend = ($latesttweetid != null)?'?count='.$tweetAuth['count'].'&id='.$latesttweetid:'?count='.$tweetAuth['count'].'&screen_name='.$tweetAuth['screen_name'];
$retOptions = array(
CURLOPT_URL => $twitterData['url'].$tweeturlappend,
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLINFO_HEADER_OUT => false,
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTPHEADER => array('Authorization: '.$tweetAuthStr)
);
$ch = curl_init();
curl_setopt_array($ch, $retOptions);
$twitterData['content'] = curl_exec($ch);
$twitterData['err_code'] = curl_errno($ch);
$twitterData['err_mssg'] = curl_error($ch);
$twitterData['header'] = curl_getinfo($ch);
curl_close($ch);
if($twitterData['err_code']<1 && isset($twitterData['header']['http_code']) && $twitterData['header']['http_code'] == "200"){
return $twitterData['content'];
}
}
public function getRandomString($randomstring = ""){
$timemix = time();
$ipmix = $_SERVER["REMOTE_ADDR"];
$agentmix = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
$domainmix = ($_SERVER["SERVER_NAME"] != '')?$_SERVER["SERVER_NAME"]:"";
$randomstring .= preg_replace("/[^a-zA-Z0-9]/","",md5($timemix.$ipmix.$agentmix.$domainmix));
if(strlen($randomstring)<32){
$randomstring = getRandomString($randomstring);
}
if(strlen($randomstring)>32){
$randomstring = substr(0,32,$randomstring);
}
return $randomstring;
}
public function getOauthSig($tweetAuth,$method,$base,$latesttweetid){
ksort($tweetAuth);
$parameters = '';
if($latesttweetid != null){
unset($tweetAuth['screen_name']);
}else{
unset($tweetAuth['id']);
}
$sigCount=1;
foreach($tweetAuth as $taKey => $taVal){
$parameters .= rawurlencode($taKey)."=".rawurlencode($taVal);
if($sigCount
@{username} {tweet}
{retweetedbyhtml} {date} {actions}', 'hashtag' => '{label}', 'userlink' => '{label}', 'externallink' => '{label}', 'actions' => ' Reply Retweet Favourite', 'retweetedlink' => ' Retweeted by {retweetauthor}'); $myTweets = new tweetData; echo $myTweets->init($tweetTemplateArr,$tweetCount); class tweetData { public function init($tweetTemplateArr,$tweetCount){ $tweetinc = LOCALDIR."/mytweets_$tweetCount.inc"; $lastIncMod = (file_exists($tweetinc))?filemtime($tweetinc):time()-7200; $evalIncDate = time()-3600; if($lastIncMod < $evalIncDate) { $tweetIncData = $this->getTweetFeed($tweetCount,null); $file = fopen($tweetinc,"w"); fwrite($file,$tweetIncData); fclose($file); } $tweetObj = file_get_contents($tweetinc); $myTweets = json_decode($tweetObj); if(JUSTJSON){ return $this->getJustJson($myTweets); } return $this->parseTweet($myTweets,$tweetTemplateArr); } public function getJustJson($myTweets){ $latesttweetid = $myTweets[0]->id_str; $tweetdate = $this->parseTweetDate($myTweets[0]->created_at); $tweetfile = LOCALDIR."/_twitterjs.html"; $lastMod = (file_exists($tweetfile))?filemtime($tweetfile):time()-7200; $evalDate = time()-3600; if($lastMod < $evalDate) { $tweetData = $this->getTweetFeed($tweetCount,$latesttweetid); $file = fopen($tweetfile,"w"); fwrite($file,$tweetData); fclose($file); } $tweetJsonObj = file_get_contents($tweetfile); return ""; } public function parseTweet($tweetData,$templateArr){ $dataFormatOutput = ''; $templateVarArr = array(); if(count($tweetData)){ foreach($tweetData as $dataItem) { $templateVarArr['tweetid'] = $dataItem->id_str; $templateVarArr['tweet'] = $dataItem->text; $templateVarArr['username'] = $dataItem->user->screen_name; $templateVarArr['userid'] = $dataItem->user->id_str; $templateVarArr['author'] = $dataItem->user->name; $templateVarArr['avatar'] = $dataItem->user->profile_image_url; $templateVarArr['profilelink'] = "https://twitter.com/".$templateVarArr['username']; $templateVarArr['permalink'] = $templateVarArr['profilelink']."/status/".$templateVarArr['tweetid']; $templateVarArr['actions'] = str_replace("{tweetid}",$templateVarArr['tweetid'],$templateArr['actions']); $templateVarArr['retweetedbyhtml'] = ""; #hastags $templateVarArr['tweet'] = $this->parseLinks($dataItem->entities->hashtags,$templateArr['hashtag'],$templateVarArr['tweet']); #urls $templateVarArr['tweet'] = $this->parseLinks($dataItem->entities->urls,$templateArr['externallink'],$templateVarArr['tweet']); #user mentiones $templateVarArr['tweet'] = $this->parseLinks($dataItem->entities->user_mentions,$templateArr['userlink'],$templateVarArr['tweet']); #date $templateVarArr['date'] = $this->parseTweetDate($dataItem->created_at); $dataFormatOutput .= preg_replace('/\{(.*?)\}/es', '$templateVarArr[\'$1\']', $templateArr['tweet'])."\n"; } } return $dataFormatOutput; } public function parseTweetDate($dateitem){ $tmpTime = strtotime($dateitem); if(date("Y",$tmpTime)
