Custom Plugin v1: PHP

13 November 2015 by admin

Our custom PHP plugin is for Publishers who are not using one of the supported CMS systems like WordPress and Drupal, but use PHP on their website. The plugin consists of three files, described below:

YResilience-API.php

This file contains a class called YResilience_API. It implements methods needed to communicate with the Yavli API server, and a simple storage system for the data it fetches from the API. The publisher is welcome to modify this according to their needs. For example, its possible to make it store the fetched code in a database rather than a flat file.

Each function is well documented inline.

example-cron-job.php

This is an example of the script that should be executed in cron on your system (or similar scheduler). You can use this example script as is, all you have to do is insert your credentials, which you should have received via email from Yavli. This script will contact the Yavli API server, and retrieve Javascript code wrapped in a <script> tag.

example-website.php

This is just an example to demonstrate what the Publisher should do with the code fetched from the API in example-cron-job.php. The publisher simply needs to add a call in their website code which includes the HTML / Javascript code which has been downloaded and stored locally.

Download

Download link: custom-yavli-resilience-plugin-v1.0.1.