GithubHelp home page GithubHelp logo

twitterfeed's People

Contributors

bramwillemse avatar stefthoen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

twitterfeed's Issues

Use better namespacing

All classes are now in one big Twitterfeed namespace. Would be nice to use folder structure and PSR-4 to set sub namespaces.

Code review and feedback

Hey, getting to that code review as you asked. :)

  1. You require class files explicitly. Fine for a plugin small enough, but generally this is something Composer autoload should handle. It can pick up arbitrary classes with classmap.
  2. bbtf() function seems is out of place. The name is not descriptive and it just passes call through.
  3. Singleton is bad pattern. In WP code it's usually remnant of faux–OOP, which uses classes as fake namespacing. In modern code anything singleton does dependency injection will do better (not that it's necessary for plugin this small).
  4. Somewhat related to previous point the single main class has too much going on. Things like translations set up are not logically related to Twitter functionality. Again, it's a small plugin now, but these things grow fast. Classes should have clear separated responsibility to what they do.
  5. Some $twitter_error seems to miss $this-> here and there.
  6. build_tweets_list() is bulky. if/else should typically be early returns instead and count of nesting should be minimal.
  7. HTML templating seems to not have enough escaping and trusting to a third party input (API returns). Personally I like to implement plugin templating with Mustache, but yet again — small enough plugin to bother with proper templating engine probably.

Twitter API only returns most recent tweets (not older than a week)

Need to find away around this, because it can happen when a low-volume Twitter feed returns less tweets than requested. Either cache the tweets in de WP database, or find out if there's a way for the Twitter API to return tweets older than a week. Probably should use WP transients.

v0.4 - vendor/autoload.php: failed to open stream / Uncaught Error: Class 'Mustache_Engine' not found

When I try to activate v0.4, I get this error:

Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory in <PATH>/web/app/plugins/bb-twitterfeed/bb-twitterfeed.php on line 30

Fatal error: require_once(): Failed opening required 'vendor/autoload.php' (include_path='.:') in <PATH>/web/app/plugins/bb-twitterfeed/bb-twitterfeed.php on line 30

Off course the fix should be performing composer dump-autoload, but ... (see next comment)

Use transients

Use WordPress transients to save tweets temporarily to the database so we don't have to use the Twitter API that frequently.

Opmerkingen Arjan

  • Return moet iets terug geven (geen empty returns)
  • Classes namespacen
  • Docblocks voor alle methods en classes (ook constructors) met duidelijke uitleg wat ze doen
  • Toon alleen uitleg, @params, en @return in docblocks
  • Hergebruik objecten (zoals Mustache_Engine) door ze als parameter mee te geven aan constructors of methods (dependency injection)
  • Check of ik alle output goed escape

Improve styling of Settings to match WP style

In an earlier version I used ACF for my API settings. The upgrade to v0.4 / v0.5 makes it a lot less visually attractive. It's a minor detail off course, but it could be as simple as using a similar HTML structure or some default WP classes, I guess?

Example of my own ACF implementation:
https://www.dropbox.com/s/o4kyq1bipdmk6mq/Schermafdruk%202017-01-12%2013.35.49.png?dl=0

Example of the current BB-Twitterfeed solution:
https://www.dropbox.com/s/kogfnl5hs8c2yn5/Schermafdruk%202017-01-12%2013.39.50.png?dl=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.