I'm building a Piwik plugin that consists of two major parts - a cron job occasionally polls a third-party for information based on some Piwik option settings, and uses the Piwik database functions to store the tracked data in custom tables in the Piwik database. The second portion will work as a standard Piwik plugin, but will poll for the custom data and display that instead of using standard Piwik queries.
For the cron portion of the plugin, I'm trying to include the Piwik Option class to allow me to poll the Piwik database for various plugin options (later, I'll be doing something similar to access the new tables, but one thing at a time).
require_once(__DIR__.'/../../core/Option.php');
abstract class Monitor{
private $display;
private $monitor;
private $dbNames;
public function __construct($dbNames){
$display = Option::get($dbNames['display']);
$monitor = Option::get($dbNames['monitor']);
....
The inclusion works, but I get a fatal error with the following message:
Fatal error: Class 'Option' not found in
/opt/lampp/htdocs/piwik/plugins/pluginName/Cron.php
The first two lines of Option.php are:
namespace Piwik;
class Option{
What little information I've turned up suggests that some sort of lazy loading is to blame, but I can't figure out how to fix it. Is there a simple Piwik boilerplate include that will allow me to access to Piwik functionality from the outside?