-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nikeo
committed
Sep 16, 2016
0 parents
commit 79e9586
Showing
26 changed files
with
2,789 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# OS generated files # | ||
# source : https://gist.github.com/octocat/9257657 | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
|
||
# GRUNT | ||
node_modules/ | ||
#grunt-tasks-config/ | ||
# gruntfile.js | ||
|
||
|
||
# BUILD | ||
build/ | ||
|
||
|
||
# WPCS | ||
wpcs/ | ||
|
||
# EXEMPLE OF ADVANCED CONFIG WITH FOLDER | ||
# Ignore everything: | ||
# * | ||
|
||
# UNIT TESTS | ||
# bin/ | ||
# tests/ | ||
|
||
# Travis | ||
travis-examples/ | ||
|
||
# Except for the themes directories: | ||
# !wordpress/ | ||
# !wordpress/*/ | ||
# !wordpress/*/wp-content/ | ||
# !wordpress/*/wp-content/themes/ | ||
# !wordpress/*/wp-content/themes/* | ||
# !wordpress/*/wp-content/themes/*/* | ||
# !wordpress/*/wp-content/themes/*/*/* | ||
# !wordpress/*/wp-content/themes/*/*/*/* | ||
# !wordpress/*/wp-content/themes/*/*/*/*/* |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
header('content-type: application/json'); | ||
//Sharrre by Julien Hany | ||
$json = array('url' => '', 'count' => 0); | ||
$_pre_url = isset($_GET['url']) ? $_GET['url'] : ''; | ||
$_pre_type = isset($_GET['type']) ? $_GET['type'] : ''; | ||
$json['url'] = $_pre_url; | ||
$url = urlencode($_pre_url); | ||
$type = urlencode($_pre_type); | ||
$proxy = null; | ||
$proxyAuth = array(); | ||
if (filter_var($_pre_url, FILTER_VALIDATE_URL)) { | ||
if ($type == 'googlePlus') { //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ | ||
$contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true'); | ||
|
||
preg_match('/window\.__SSR = {c: ([\d]+)/', $contents, $matches); | ||
|
||
if (isset($matches[0])) { | ||
$json['count'] = (int)str_replace('window.__SSR = {c: ', '', $matches[0]); | ||
} | ||
} else if ($type == 'stumbleupon') { | ||
$content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url=$url"); | ||
|
||
$result = json_decode($content); | ||
if (isset($result->result->views)) { | ||
$json['count'] = $result->result->views; | ||
} | ||
|
||
} | ||
} | ||
echo str_replace('\\/', '/', json_encode($json)); | ||
|
||
function parse($encUrl) | ||
{ | ||
global $proxy; | ||
global $proxyAuth; | ||
$options = array( | ||
CURLOPT_RETURNTRANSFER => true, // return web page | ||
CURLOPT_HEADER => false, // don't return headers | ||
CURLOPT_FOLLOWLOCATION => true, // follow redirects | ||
CURLOPT_ENCODING => "", // handle all encodings | ||
CURLOPT_USERAGENT => 'sharrre', // who am i | ||
CURLOPT_AUTOREFERER => true, // set referer on redirect | ||
CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect | ||
CURLOPT_TIMEOUT => 10, // timeout on response | ||
CURLOPT_MAXREDIRS => 3, // stop after 10 redirects | ||
CURLOPT_SSL_VERIFYHOST => 0, | ||
CURLOPT_SSL_VERIFYPEER => false, | ||
); | ||
$ch = curl_init(); | ||
if ($proxy != null) { | ||
$options[CURLOPT_PROXY] = $proxy; | ||
if (isset($proxyAuth['user']) && isset($proxyAuth['pwd'])) { | ||
$options[CURLOPT_PROXYUSERPWD] = $proxyAuth['user'] . ':' . $proxyAuth['pwd']; | ||
} | ||
} | ||
$options[CURLOPT_URL] = $encUrl; | ||
curl_setopt_array($ch, $options); | ||
|
||
$content = curl_exec($ch); | ||
$err = curl_errno($ch); | ||
$errmsg = curl_error($ch); | ||
|
||
curl_close($ch); | ||
|
||
if ($errmsg != '' || $err != '') { | ||
/*print_r($errmsg); | ||
print_r($errmsg);*/ | ||
} | ||
return $content; | ||
} |
Oops, something went wrong.