“Hybridauth enables developers to easily build social applications and tools to engage websites visitors and customers on a social level by implementing social sign-in, social sharing, users profiles, friends list, activities stream, status updates and more.
The main goal of Hybridauth is to act as an abstract API between your application and various social apis and identities providers such as Facebook, Twitter and Google.”
Hybridauth 2.x was the best option for nicely aggregated social logins so far, but some of the social “Providers” are outdated or no longer working. Version 3.0 is still in development, but providing a complete rewrite.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
require 'vendor/autoload.php'; $config = [ 'callback' => 'http://localhost/hybridauth/examples/twitter.php', 'keys' => [ 'key' => 'your-consumer-key', 'secret' => 'your-consumer-secret' ] ]; $twitter = new Hybridauth\Provider\Twitter( $config ); try { $twitter->authenticate(); $userProfile = $twitter->getUserProfile(); $accessToken = $twitter->getAccessToken(); $apiResponse = $twitter->apiRequest( 'statuses/home_timeline.json' ); } catch( Exception $e ){ echo "Ooophs, we ran into an issue! " . $e->getMessage(); } |
Hybridauth 3.0 Remake @ Github
For Facebook , Twitter and Google+ I still use my own little wrappers, but if you want more this is the way to go in the future :)
Currently refreshing my list of options to document projects and APIs.
I will use this page to keep a list of possible tools & solutions.
E-Learning platform for Thailand
Really neat solution, that allows you to build a quick viewport based layout, without relying on the still buggy CSS units.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<head> <!-- Add vUnit.js to the head to avoid FOUC --> <script src="path/to/vunit.js"></script> <!-- Instantiate vUnit.js passing a CSSMap with properties you want to play with --> <script> new vUnit({ CSSMap: { // The selector (VUnit will create rules ranging from .selector1 to .selector100) '.vh_height': { // The CSS property (any CSS property that accepts px as units) property: 'height', // What to base the value on (vh, vw, vmin or vmax) reference: 'vh' }, // Wanted to have a font-size based on the viewport width? You got it. '.vw_font-size': { property: 'font-size', reference: 'vw' }, // vmin and vmax can be used as well. '.vmin_margin-top': { property: 'margin-top', reference: 'vmin' } }, onResize: function() { console.log('A screen resize just happened, yo.'); } }).init(); // call the public init() method </script> </head> <body> <h1 class="vw_font-size15">This title font-size is 15% of the viewport width.</h1> <p class="vh_height50">This p's height is 50% of the viewport height.</p> <p class="vmin_margin-top5">This p has some margin-top<p> </body> |
Also works nicely in combination with Visual Composer for WordPress :)
When working on projects in a team, sharing passwords is always happening. But how do you securely share passwords among team mates. I am using 1Password for years on all my devices. I am glad to see them expanding their offers with a team based password safe. The current setup is in beta and free to test.
“WP-CLI is a set of command-line tools for managing WordPress installations”
1 2 3 4 5 6 7 8 9 10 |
Available commands: wp blog create|delete wp cache add|decr|delete|flush|get|incr|replace|set|type wp comment create|delete|trash|untrash|spam|unspam|approve|unapprove|count|status|last wp core download|config|is-installed|install|install-network|version|update|update-db wp db create|drop|reset|optimize|repair|connect|cli|query|export|import wp eval-file ... See 'wp help <command>' for more information on a specific command. |
Using WordPress as a headless system, is nothing new. You can easily build out your own REST API or use the long available HTTP REST API 1.0+ for WordPress.
But with the new HTTP REST API 2.0+ its getting really easy to build out your own REST API Namespace and assign routes for all your JSON needs.
The new REST API will make its appearance in WordPress 4.4, but you can start now by adding the plugin to your system. When the plugin detects 4.4+ it will only load functionality not already present in the core.
A route tells the API to respond to a given request with a specific function (endpoint). This adds the permalink structure to WordPress so that your functionality can be accessed via an url like this: http://yourdoman.com/wp-json/yourplugin/v1/myfunction/your_parameter
1 2 3 4 5 6 |
add_action( 'rest_api_init', function () { register_rest_route( 'your_namespace/v1', '/your_endpoint/(?P<your_parameter>\d+)', array( 'methods' => 'GET', 'callback' => 'your_endpoint', ) ); } ); |
The Endpoint is the callback handled by the route. Each endpoint can have additional parameters attached:
The return values from the endpoint are converted into JSON. You can use the WP_REST_Response object , this wraps normal body data and allows you to return a custom status code.
1 2 3 4 5 6 7 8 9 10 11 |
function your_endpoint( $data ) { $posts = get_posts( array( 'author' => $data['your_parameter'], ) ); if ( empty( $posts ) ) { return new WP_Error( 'your_endpoint_no_data', 'No Data', array( 'status' => 404 ) ); } return new WP_REST_Response( $posts, 200 ); } |
Really powerful stuff, that makes it easy to detach WordPress and the actual client using the data provided by it.
You can read more about it here.
Some options to get those translatable strings out of your templates. I will be adding new things, as I discover them :)
Flarum is new elegant next-generation forum software. It provides a touch optimized two pane layout with floating composer.
The backend runs on PHP/MySQL.