Download the PHP package automattic/liveblog without Composer

On this page you can find all versions of the php package automattic/liveblog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package liveblog

Liveblog

Build Status

Empowers website owners to provide rich and engaging live event coverage to a large, distributed audience.

Description

Your readers want your updates as quickly as possible, and we think we provide the easiest and the most flexible publishing environment to make that happen. Sometimes though, that’s just not enough.

When you’re covering a fast-paced event — the latest Apple unveiling, an F1 Grand Prix, or the Super Bowl — a full blog post for each individual update is a poor experience for your authors and your audience.

The WordPress.com VIP Liveblog Add-On was purpose-built to address these issues specifically.

Here’s what makes it special:

If you'd like to check out the code and contribute, join us on github, pull requests are more than welcome.

Installation

  1. Upload the liveblog folder to your plugins directory (e.g. /wp-content/plugins/)
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. You can enable the liveblog on any post's edit page

Overview

The entry system supports #hashtags, /commands, @authors and :emoji: with an autocomplete system to help speed up the process. These extensions are filtered on save, for example a hashtag #football would be saved as <span class="liveblog-hash term-football">football</span> allowing easy styling. The container of the entry will also receive the same class term-football.

The command system has one inbuilt command:

/key: Which defines an entry to a key event, it adds the meta key to entry liveblog_key_entry. A key event can be styled using the .type-key class.

To display a key event box you can add the [liveblog_key_events] shortcode in your theme, e.g. in the sidebar, or you can use the Liveblog Key Events widget. Entries used with the key command will be inserted to both this box and the main feed. It also acts an anchor system to jump to parts of the main feed. It's not necessary to include the shortcode for the /key command to be enabled.

An example of using the key command would be an author writing the following in the New Entry box:

You can add new commands easily with a filter, the most basic command will add a class to entry, so you could do a simple /highlight which would add type-highlight to the entry container, letting you style the background color:

A command can have both a filter called before the entry is saved, or an action that is called after it’s saved:

Customizing Key Events Shortcode

As mentioned earlier you can add the key events section by using [liveblog_key_events]. If you wish to change the title from the default Key Events then you can add a title attribute:

If want to remove the title, good example when placing the shortcode in a widget.

A key event entry can be altered in to two ways:

Template: This is how each entry will be rendered. There are two inbuilt templates: list and timeline, or you can add your own using a filter:

There's a few things to note here:

An example of a template file is:

Format: This is how each entries content is filtered, there are three inbuilt formats:

Formats add an extra level of control to how the key events section looks. If using the timeline template with first sentence and the following is entered into the new entry box:

The main feed would show the full text, and the key events section would only show:

You can add your own using a filter:

In the example above we are adding a format Strip Tags, which removes any HTML tags from the content.

Below is the full example of adding both:

Selecting which template or format to use for liveblog happens in the admin panel on the edit of page of the post:

687474703a2f2f73686172652e61676e65772e636f2f477961692b

Managing Hashtags

Hashtags are manageable in the admin area. Under Posts there will be a menu for Hashtags. Please note that the slug is used, not the name.

Emojis

When a :emoji: is inserted into an entry it is converted into:

<img src="//s.w.org/images/core/emoji/72x72/1f44d.png" class="liveblog-emoji emoji-+1">

Extending the Admin Meta Box

If you need to extend the Admin Meta Box there are a few filters and actions to make this easier. As an example, let's add a section with a text input and a button to save. To start we need to add the fields:

Filter

Template

Next we catch when the user has clicked our new save button liveblog-new-input-save:

Hooking into Entries

There is five useful filters to alter entries at current stages:

Before inserting into the database

Before inserting updated entry into the database

Before we show preview (how we convert :emoji: back to <img>)

Before we allow the entry to edited (how we convert <img> back to :emoji:)

Before the entry JSON is sent to the frontend

Altering hashtags, commands, authors and emoji

It is possible to set your own symbol and / or change the class prefix for #hashtags, /commands, @authors and :emoji:. These are handled by filters:

Let’s say you decide to use ! instead of # for #hashtags, therefore you expect them to be !hashtag:

Currently hashtags use the class prefix term-, you can change that to whatever you need - in this case let’s change to hashtag-:

Shortcode Filtering

Developers have to ability to exclude shortcodes from being used within the content of a live entry. By default the in built key events widget short code is excluded, but others can be added easily enough from within the themes .

The functionality takes a associative array of key value pairs where the key is the shortcode to be looked up and the value is the replacement string.

So, given the example above an editor adding any of the shortcode formats:

/ /

would see outputted on live entry.

By default the inbuilt shortcode is replaced with .

To override this behaviour simple redefine the array key value:

Auto Archiving of Live Blog Posts

This feature was added at the request of the community and solves the issues where Editors will forget to archive old Live Blog's leaving them live indefinitely.

Auto archive works by setting an expiry to the Post Meta for live blog posts. This expiry is calculated using the date of the latest liveblog entry + the number of days configured.

Once the expiry date is met the live blog post will be auto archived. It is however possible to re-enable an auto archived Live Blog Post, simply click the enable button in the post Liveblog meta box and the expiry will be extended by the number of days configured from the latest liveblog entry date. The auto archiving feature will then re-archive the post at the new expiry date.

In order to configure the number of days to autoarchive after, a filter has been implemented. By default the value is NULL and as such disables the feature. To enable it simply apply a value to the filter e.g:

WebSocket support

By default this plugin uses AJAX polling to update the list of Liveblog entries. This means that there is a delay of a few seconds between the moment a entry is created and the moment it is displayed to the users. For a close to real-time experience, it is possible to configure Liveblog to use WebSockets instead of AJAX polling. To achieve this, Liveblog uses Socket.io, Redis and socket.io-php-emitter (responsible for sending messages from PHP to the Socket.io server via Redis).

It is important to note that, since for now the Socket.io server has no way to tell if a client is an authenticated WordPress user or not and what are its capabilities, WebSockets will be used only for public Liveblog posts.

Follow the instructions below to enable WebSocket support.

Requirements

Here is a list of what needs to be installed on the server to enable WebSocket support:

Install dependencies

Connected via SSH on the server, it is necessary to run the following commands from the Liveblog plugin directory to install WebSocket support dependencies:

Configuration

Add the following constants to wp-config.php to configure Liveblog plugin to use WebSockets:

Running the Socket.io server

To start the Socket.io server go to the plugin directory and run:

This will start a Socket.io server on port 3000 listening to a Redis server running on localhost:6379. It is possible to use the parameters bellow to change the app default values:

For more information on the accepted parameters run:

Making sure everything is working

To test that everything is working, after following the steps above, open a Liveblog post in two different browser windows and check that whenever a user changes the list of entries in one window, the list in the other window is refreshed in "real-time". It is also possible to use the browser developer tools to verify that there are no AJAX requests being sent every few seconds to check for changes in the list of entries. Instead the browser is receiving changes using a single WebSocket connection whenever they occur.

Important note about private Liveblog posts

When using Liveblog with WebSocket, the plugin will create a unique key for each Liveblog post (based on the post ID and its status). This key is shared with the users with permission to see the corresponding post when the page is loaded. The key is then send by the user's browser to the Socket.io server when a connection is established. Whenever there is a new Liveblog entry (or a Liveblog entry is updated or deleted), the Socket.io server will send a message only to the clients that provided the right key. This system is enough to prevent someone without permission to see the post from receiving Liveblog entries emitted by the Socket.io server but it has an important limitation. Once a user with permission receives the post key, if he saves it somewhere, he will be able to receive messages from the Socket.io server for that particular post even if for some reason he loses access to the post (for example if the user is removed from WordPress).

If you are using private Liveblog posts to share sensitive data and it is important that, once a user loses access to the post, he is not able to receive messages emitted by the Socket.io server anymore, consider using the 'liveblog_socketio_post_key' filter to implement your own criteria to generate the post key. For example, you could generate a random post key for each post that is saved as a post meta and that can be manually invalidated by an editor whenever necessary.

Tips for debugging

If for some reason the plugin is not able to use WebSockets to refresh the list of entries, below is a list of tips that might help you debug where is the problem:

Screenshots

The entry form is the simplest possible Writers can preview before posting New posts are highlighted Adding images is a matter of just drag-and-drop Dragged photos are automatically inserted Typical liveblog view

In-Depth Documentation

Creating a Liveblog

The liveblog lives inside of a regular WordPress post. First create a new post, complete with title, category, and maybe a short introduction. Once the liveblog plugin is installed, you will see a liveblog box on your "Edit Post" page. Simply click "Enable" to activate it, and publish the post.

If you can't find the box, be sure that it is toggled on under "Screen Options" in the top right corner of posting page.

Screen options

Posting to the Liveblog

To post to the liveblog, navigate to the live post, and start typing. Click "Publish Update," and your readers will see the post appear at the top of their screen. That's all there is to it.

Click Publish Update

Adding a Photo

To add a photo to your update, simply drag-and-drop it into the posting box from your desktop. It will upload the image and include a link. To see the image, click "Preview."

You can also add photos from the internet by pasting in the direct URL to the image.

add photos

Embedding Media

To embed the media, simply paste the URL while viewing the media into the posting box on its own line. More details can be found about each media type in the links below:

Screen shot for media embeds

Formatting a Post

The liveblog posting box takes standard HTML formatting. To format text, simply wrap it in HTML tags.

Examples:

Links that are pasted directly the posting box will also be automatically hyperlinked.

Manually embed a Liveblog

Sometimes you may need to manually insert the Liveblog into your theme. For this, we provide a function which simply outputs the Liveblog HTML on a post where the Liveblog is enabled.

wpcom_liveblog_get_output

Editing Previous Posts

While a liveblog is enabled, you can edit previous posts by clicking the "Edit" button next to the update.

Edit post

Archiving a Liveblog

Once the event has wrapped up, you can archive your liveblog. This means that visitors will still be able to see the blog, but the editing tools will go away and the post will stop polling for updates. You can archive and re-enable a liveblog from the Edit Post page.

Archiving a liveblog

When a liveblog is archived, your editors will see a notification that says the liveblog must be enabled to accept new posts.

Notification that liveblog must be enables

"Smart" Updates

The liveblog uses smart updates, making it easy for your readers to enjoy your liveblog without being overwhelmed with updates. If the reader's browser is at the top of the post, new posts will automatically appear, highlighted in yellow.

Screenshot of smart updates

However, if your reader has scrolled down the post to catch up on previous updates, liveblog will wait to update with new posts. Instead, a notification bar will appear at the top of the screen. When the reader clicks on the bar, the new updates will resume loading at the top of the page.

Screenshot of notification

Post times are also now relative, which means it will display as “2 minutes ago,” with the time updating every minute.

Overriding default templates

Templates used by the plugin can be found in the /templates/ directory of the plugin.

You can edit these files in an upgrade-safe way using overrides. Copy the files you want to change into a directory named /liveblog within the root of your theme, keeping the same filename.

Eg: In order to override a single entry template copy templates/liveblog-single-entry.php to yourtheme/liveblog/liveblog-single-entry.php

The copied file will now override the Liveblog default template file.

Check out the related code on GitHub.

Custom location for Liveblog templates

In case the /liveblog directory in the root of your theme is not what would suit your needs, you can take advantage of the liveblog_template_path filter and pass in a custom absolute path without trailing slash which would then be used for template look-up.

Check out the related code.


All versions of liveblog with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
composer/installers Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package automattic/liveblog contains the following files

Loading the files please wait ....