Changeset 1458863
- Timestamp:
- 07/22/2016 10:03:55 AM (10 years ago)
- Location:
- fb-display-events-shortcode
- Files:
-
- 23 added
- 2 edited
-
tags/1.0 (added)
-
tags/1.0/admin (added)
-
tags/1.0/admin/admin.php (added)
-
tags/1.0/classes (added)
-
tags/1.0/classes/FB_event.php (added)
-
tags/1.0/classes/class.translator.php (added)
-
tags/1.0/css (added)
-
tags/1.0/css/dynamic_styles.css (added)
-
tags/1.0/css/fdes_css.css (added)
-
tags/1.0/css/jquery.tosrus.all.css (added)
-
tags/1.0/fb-display-events-shortcode.php (added)
-
tags/1.0/js (added)
-
tags/1.0/js/even_js.js (added)
-
tags/1.0/js/jquery.tosrus.min.all.js (added)
-
tags/1.0/js/lightboxik.js (added)
-
tags/1.0/lang (added)
-
tags/1.0/lang/fb-display-events-shortcode-de_DE.mo (added)
-
tags/1.0/lang/fb-display-events-shortcode-de_DE.po (added)
-
tags/1.0/lang/fb-display-events-shortcode-en_US.mo (added)
-
tags/1.0/lang/fb-display-events-shortcode-en_US.po (added)
-
tags/1.0/lang/fb-display-events-shortcode-pl_PL.mo (added)
-
tags/1.0/lang/fb-display-events-shortcode-pl_PL.po (added)
-
tags/1.0/readme.txt (added)
-
trunk/fb-display-events-shortcode.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fb-display-events-shortcode/trunk/fb-display-events-shortcode.php
r1285473 r1458863 145 145 ) 146 146 ); 147 147 148 148 try 149 149 { 150 $json = file_get_contents ($json_link);150 $json = file_get_contents_curl_my($json_link); 151 151 } 152 152 catch (Exception $e) … … 248 248 try 249 249 { 250 $json = file_get_contents ($json_link);250 $json = file_get_contents_curl_my($json_link); 251 251 } 252 252 catch (Exception $e) … … 426 426 return $translated; 427 427 } 428 428 function file_get_contents_curl_my($url, $retries=5) { 429 { 430 $ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; 431 if (extension_loaded('curl') === true) 432 { 433 $ch = curl_init(); 434 curl_setopt($ch, CURLOPT_URL, $url); // The URL to fetch. This can also be set when initializing a session with curl_init(). 435 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly. 436 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 437 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // The number of seconds to wait while trying to connect. 438 curl_setopt($ch, CURLOPT_USERAGENT, $ua); // The contents of the "User-Agent: " header to be used in a HTTP request. 439 curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); // To fail silently if the HTTP code returned is greater than or equal to 400. 440 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // To follow any "Location: " header that the server sends as part of the HTTP header. 441 curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); // To automatically set the Referer: field in requests where it follows a Location: redirect. 442 curl_setopt($ch, CURLOPT_TIMEOUT, 5); // The maximum number of seconds to allow cURL functions to execute. 443 curl_setopt($ch, CURLOPT_MAXREDIRS, 5); // The maximum number of redirects 444 $result = trim(curl_exec($ch)); 445 446 curl_close($ch); 447 } 448 else 449 { 450 $result = trim(file_get_contents($url)); 451 } 452 if (empty($result) === true) 453 { 454 $result = false; 455 if ($retries >= 1) 456 { 457 sleep(1); 458 return file_get_contents_curl_my($url, --$retries); 459 } 460 } 461 return $result; 462 } 463 } 429 464 /** 430 465 * Display message that fb_user_id or fb_event_id is not setted -
fb-display-events-shortcode/trunk/readme.txt
r1285473 r1458863 5 5 Tags: Facebook, shortcode, event, events, fb, list 6 6 Requires at least: 3.1 7 Tested up to: 4. 3.18 Stable tag: 1. 07 Tested up to: 4.5.3 8 Stable tag: 1.1 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 87 87 example curl.cainfo = "c:\xampp\cacert.pem" 88 88 89 = How to check if token is working = 90 91 Sample below is generated from plugin. Just replace XXXXX with your token. Place that link into browser. If the token is valid you will get data from facebook. You can modify this url. 463776883765579 is user id. Sice and until are timestamps. 92 93 https://graph.facebook.com/463776883765579/events/attending/?fields=id,name,description,place,timezone,start_time,cover&access_token=XXXXXXXXXXXXXXXXXXX&since=1388534400&until=1468972800 94 95 89 96 == Screenshots == 90 97 … … 95 102 == Changelog == 96 103 104 = 1.1 = 105 Upgraded data access to fb not only via file_get_contents but also cURL 106 97 107 = 1.0 = 98 108 * Initial release … … 100 110 == Upgrade Notice == 101 111 112 = 1.1 = 113 Upgraded data access to fb not only via file_get_contents but also cURL 114 102 115 = 1.0 = 103 116 Initial release
Note: See TracChangeset
for help on using the changeset viewer.