pdincubus / jsonderulo Goto Github PK
View Code? Open in Web Editor NEWJSON feed getter-er for MODX Revolution CMS
License: Other
JSON feed getter-er for MODX Revolution CMS
License: Other
I successfully set up a Twitter feed using the JSONDerulo snippet (2.6.0) in MODX (2.4.3). I wanted to show two separate Twitter feeds on the same page, so I created an app in the second Twitter account, created a new call to JSONDerulo with the new app details, tested it and it runs fine.
However, if I run both together on the same page, the page breaks: blank screen in FF, HTTP ERROR 500 in Chrome.
Checking my error log, I see:
[-date-] [warn] [client -IP-] mod_fcgid: stderr: PHP Fatal error: Cannot redeclare sksort() (previously declared in /[site path]/httpdocs/core/cache/includes/elements/modsnippet/65.include.cache.php:740) in /[site path]/httpdocs/core/cache/includes/elements/modsnippet/65.include.cache.php on line 740
I wrapped the sksort() function in the snippet in a conditional, as follows:
if (!function_exists('sksort')) {
function sksort( &$array, $subkey, $sort_ascending ) {
// Unaltered function code
...
}
}
and that solved the issue, at least to the extent that I am using the snippet (2x Twitter feeds).
Hope that's of help, but will be interested to know if there is a better way to call the snippet multiple times per page.
Hi,
Thanks for this add-on. Im not sure if this is the right place to post this and if the code is clean, but anyway, i'd like to let you know that I change the code a bit so links, hashtags and @ sign get converted into links. Hereby the code. It took it from the montwitter add-on. Maybe it's useful for you or anyone else. At around line 58 I changed it to this.
$input = $message->text;
// Convert URLs into hyperlinks
$input= preg_replace("/(http:\/\/)(.*?)\/([\w\.\/\&\=\?\-\,\:\;\#\_\~\%\+]*)/", "<a href=\"\\0\">\\0</a>", $input);
// Convert usernames (@) into links
$input= preg_replace("(@([a-zA-Z0-9\_]+))", "<a href=\"http://www.twitter.com/\\1\">\\0</a>", $input);
// Convert hash tags (#) to links
$input= preg_replace('/(^|\s)#(\w+)/', '\1<a href="http://search.twitter.com/search?q=%23\2">#\2</a>', $input);
$rawFeedData[$i] = array(
'id' => $message->id_str,
'message' => $input,
'created' => strtotime($message->created_at),
'picture' => $message->user->profile_image_url,
'title' => $message->user->name,
'username' => $message->user->screen_name,
'retweetCount' => $message->retweet_count,
'isRetweet' => '0',
);
on line 225 and line 1242 a "continue" is used in loop context. replacing it with a "return" solved it in my first impression
They closed api 1, but I use api 1.1 version. It's dont work(
I always get โNo tweets returned.โ message (MODX 2.7.0) with Twitter
My MODX cache_handler setting is on xPDOMemCached, and when I go back to xPDOFileCache, jsonDeroulo works.
Hi,
Is instagrams new API working in the latest version? I can't seem to get it to work.
Thanks,
Hello,
Not sure what I might be doing wrong here (if anything), but my twitter feed is blank. I've got the most recent version of the extra installed and my app setup properly. It was working as of a couple weeks ago, but suddenly it's stopped generating anything (this may have coincided with my updating REVO to 2.2.8-pl...not sure).
Here are my code blocks:
[[!TwitterFeedNew? &tpl=TwitterFeedItemNew
&limit=4
&cacheName=thefutureFWD
&screenName=thefutureFWD
&includeRTs=1
&consumerKey=&consumerSecret=
&accessToken=&accessTokenSecret=
&cacheTime=60
]]
<li class="cf">
[[+id:notempty=`
[[+isRetweet:is=`1`:then=`
<a href="http://twitter.com/#!/[[+originalUsername]]">
<img src="[[+originalAuthorPicture:phpthumbof=`q=85&w=48&h=48`]]" alt="[[+originalAuthor]]">
<span class="userfullname">[[+originalAuthor]]</span>
<span class="username">@[[+originalUsername]]</span>
</a>
`:else=`
<a href="http://twitter.com/#!/[[+username]]">
<img src="[[+picture:phpthumbof=`q=85&w=48&h=48`]]" alt="[[+title]]">
<span class="userfullname">[[+title]]</span>
<span class="username">@[[+username]]</span>
</a>
`]]
<div class="tweet">
[[+message]]
</div>
<a href="http://twitter.com/#!/[[+username]]/status/[[+id]]">
<time datetime="[[+created:date=`%Y-%m-%d`]]">[[+created:date=`%e %B`]]</time>
</a>
<ul class="cf">
<li><a href="https://twitter.com/intent/tweet?in_reply_to=[[+id]]" class="twitterReply">Reply</a></li>
<li><a href="https://twitter.com/intent/retweet?tweet_id=[[+id]]" class="twitterRetweet">Retweet</a></li>
<li><a href="https://twitter.com/intent/favorite?tweet_id=[[+id]]" class="twitterFavourite">Favourite</a></li>
</ul>
`:default=`
[[+message]]
`]]
</li>
It should be appearing in the "info tab" on the right, but I'm getting nothing:
http://thefutureforward.com
Let me know if you need any more info or have any thoughts on this!
As an example you can see http://franck-unrayondesoleil.com/index.php?id=3
On tweets that include an image, the t.co URL begins with http:// and gets wrapped.
On tweets including a pasted URL, the t.co URL begins with https:// and does NOT get wrapped.
Have I missed something ? Thanks for your answers...
Has there been any thought into potentially integrating Instagram into this plugin?
I may need to do this, so if I do I will send over the code unless you have something in the works at all? Happy to discuss over email if you would prefer.
Many thanks,
Jonathan
I have implement the extra and I am getting tweets coming through, but the [[+message]] appears to only allow a certain number of characters and I am finding the whole tweet doesn't appear. How do I increase the length of the message?
I think I found a bug unless I'm doing something wrong, I have 2 FlickrFeed calls one for a gallery with a limit if 65 and another one on the footer gallery with a limit of 15.
Both are calling the same gallery the problem I'm having is the one in the gallery is ignoring the limit of 65 I set and instead displays the 15 I set as the limit on the main footer gallery.
Let me know if I'm doing something wrong.
Here are my 2 FlickrFeed calls:
Gallery call:
[[FlickrFeed? &tpl=FlickrFeedItem3
&limit=65
&users=63094881@N04
&apiKey=********
&userName=ignitetampabay
&cacheTime=30
]]
This is my FlickrFeed call I have in my footer:
[[FlickrFeed? &tpl=FlickrFeedItem2
&limit=15
&users=63094881@N04
&apiKey=********
&userName=ignitetampabay
&cacheTime=30
]]
You can see the live sample here:
http://2013.ignitetampa.net/gallery.html
Thanks for this great plugin it's pretty awesome.
I am trying to add default text for when a Google Calendar has no upcoming events, however, the following is being ignored:
[[JSONDerulo:isempty=<li>There are no events scheduled at this time.</li>
?
&feed=googlecalendar
&tpl=googleCalendar-tpl
&limit=5
...
..
.
]]
When I change [[+title:neq=No events.
:then=CHUNK
:else=[[+title]]
]] to something more informative like "There are no events at this time", the full chuck will show with empty fields.
Hi there,
Recently Google changed the way how to create an API key. I've tried to create all kinds of keys in the developer console, but I can't make the calendar to work. It worked fine just before the introduction of the key variable. Can anybody tell me how to create a key which can be used? I'm confused.
[[!JSONDerulo?
&feed=`googlecalendar`
&limit=`25`
&cacheTime=`1`
&cacheName=`kalender2`
&feedLocation=`[email protected]`
&apiKey=`AIzaSyCoSCfxxx-CHZU9uQpltuxxxxx`
&tpl=`google-calendar.feed.tpl`
]]
https://youtube-eng.googleblog.com/2015/04/bye-bye-youtube-data-api-v2.html
Your snippet now keeps returning "No longer available" for the v2's snippet call.
When trying to download the package it shows the following error:
Could not download and create transport package with signature: jsonderulo-2.5.5-pl
This error occurs at lines with the following code (including 225 and 1237):
if ($feed === null) {
continue;
}
It can be patched by replacing continue with return;
Eventbrite have changed their API and expansions are now needed to get the extra fields. See https://www.eventbrite.com/developer/v3/reference/expansions/
I added &expand=event,venue,ticket_classes to the feedUrl
@pdincubus, @ka8578 thought I'd open up a new issue for this as it seems to be a problem for me as well. I'll investigate and submit a PR when I have a fix.
Small issue with the google calendar dates:
'eventEnd' => strtotime($event->start->dateTime),
'eventStart' => strtotime($event->end->dateTime),
a pretty obvious fix, just FYI for your next update.
Hi,
first of all: thanks for this great snippet!
However, I have problems with all day events. Their title is shown, but not the date ([[+eventStart]]). If it's an event with starting/ending time given (like 4-5pm), everything is OK.
Here's my snippet call:
and my chunk
sorry in advance if these questions are too noob for you, but i'm having a little trouble understanding / finding info/instructions on some of these things. i do know HTML/CSS. getting started learning JS/JQuery. & new to ModX Revo. so i respectfully request your patience & acknowledgement on these things.
i'm trying to embed a Tumblr blog into a ModX site. before finding your modx addon, i was attempting to hack together whatever i could find using Jquery/Ajax & the Tumblr API. it's been a challenge to say the least. in hopes that this method would be easier & more efficient & flexible, i installed your addon & copied this code from your readme...
<ul>
[[!JSONDerulo?
&feed=`tumblr`
&tpl=`jd.tumblr`
&limit=`LIMIT`
&cacheTime=`CACHE_TIME_IN_SECONDS`
&cacheName=`UNIQUE_NAME_FOR_CACHE_FILE`
&tag=`TAG TO FILTER BY`
&postType=`POST TYPE TO FETCH`
¬esInfo=`TRUE or FALSE`
&blogUrl=`YOUR TUMBLR URL`
&apiKey=`API KEY`
&random=`1 OR 0`
]]
</ul>
...into a new page/resource.
1) &limit - i'm assuming this means "how many posts to show/embed/get". if so, no matter what number i put in there, it still pulls in all of them (which is only 13, because that's how many test tumblr posts i've made thus far). am i missing something here?
2) &cache* - i'm not understanding what these 2 properties mean. if it has anything to do with how often the feed is updated, i'd like it to show new blog posts immediately when made on tumblr.
3) &blogUrl - am i to include the "http://" part here, or just the "blogname.tumblr.com"?
note: i "did" successfully go thru the steps to aquire the blog API KEY.
4) &random - does this mean to not have the posts sorted? if so, which does the 1/0 represent (assuming they represent Yes/No)? and if 'no', then hoping the sort order will be "most recent on top".
5) STYLE - is there a way to pull in the tumblr theme style with the feed?
6) FLASH - i did a tumblr blog post for each of the 'types' in an attempt to test all the options to make sure they come thru ok. i've noticed the "Audio" post embeds the audio in an old FLASH player. do you know how i can change this to be an HTML5 player instead?
7) VIDEO - i found why 1 youtube video was embedded 3 times of different sizes... can i make my own size for the embed by changing [[+player500]] to say [[+player450]] or other number?
8) IMAGES - since the images brought over is just the url to them, would i add the needed HTML/CSS in the tumblr Chunk file to have them be shown, or is there another method i'm not finding?
9) LINKS - link posts on tubmlr shows a preview image of the link; any way to get that brought over too?
10) TYPES - in looking at the tumblr chunk, it's only showing 5 of the 8 post types (missing Quote, Chat, & Answer). to add the other 3, would i (for example) copy the section for Text posts, then change the eq=text
to eq=quote
, and change +title to +text and +content to +source (& follow suite if more/less options)?
again, sorry for the length & beginner-level questions. if this is too absurd to answer, i understand. if not, i thank you for your time & expertise & kindness.
-jason.
I'm trying to get the fullImage url to load, when I load up the json feed in browser the field is populated. However when I try adding 'fullImageUrl' => $message->object->attachments->fullImage->url, to the rawfeeddata array in you snippet I can not get the url to show up..
๐ฆ That is all.
Hi, I am having some issues setting up the youtube v3 playlist. Not sure if I have configured my API Key incorrectly, since I have otherwise followed the example. I activated my YouTube v3 API, and have tried with both browser and server keys. Any guidance you could offer?
Hi there!
I tried your package and I like it. But I would like to show the images by albumid, not the most recent ones. Is this possible?
Cheers in advance.
Hi, am only using this extra for twitter but am getting a lot of the following errors in the modx log:
(ERROR @ /core/cache/includes/elements/modsnippet/85.include.cache.php : 751) PHP warning: Illegal string offset 'created_at_timestamp'
Line 751 is:
if(!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) {
Haven't got time to look into this right now, just wondering if anything stands out that could be causing error?
I think this extra could benefit from having a random functionality, for example in the FlickFeed snippet if I wanted to display a random image on a page each time it was loaded.
Something like &random=1
that you can turn on or off.
Anyways keep up the good work the extra is awesome, just wish I could contribute more but my PHP skills are n00bish.
Can not get the snippet to pull any calender events. Running modx 2.3.1 and the latest version of this plugin. Any help is appreciated.
https://developers.google.com/google-apps/calendar/v1/developers_guide_protocol
What needs to be done to use V3?
Hi guys,
This is actually a feature request.
We needed to switch the order that tweets were displayed on the website (by default it is in descending order) as we needed the latest tweet first.
We found this line and set to true to get the desired effect:
sksort($tweets, 'created_at', false);
sksort($tweets, 'created_at', true);
Would be great if there was an option to assign to the twitter call and set true or false for ascending order. I could do this when I get a little more time if needs be.
Regards,
Jon
Hi and thanks for this plugin.
Is it possible to use it to import a custom Json feed into Modx ?
Thanks for JSONDerulo. Just swapped out the broken getFeed twitter-getter thing on my site with TwitterFeedNew from this package in a few minutes :)
One thing I notice is that the cache time is hardcoded to 12 hours, but as a twitter fanatic like myself I'd prefer lowering that to 1 or 2 hours. If this was configurable through a snippet property, that'd be possible without having change the snippet and losing clean upgrades :)
Am able to pull all other feed through apart from instagram - have followed instructions and created a client ID
Can you confirm if this is still working and how can i debug to see whats not pulling through correctly?
Thanks
You must hate me by now... anyways... It would be nice to have the items to show up with the [[+eventStart]] as method of sorting, first event etc...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.