/**
 * Load the xml to be used in furter processes
 *
 *
 */
function haarlem_tangram_get_xml()
{
    static $xml_cache;
    if (isset($xml_cache)) {
        return $xml_cache;
    }
    // default to failure
    $xml_cache = false;
    // get the file
    $plugin = elgg_get_plugin_from_id('haarlem_tangram');
    $fh = new ElggFile();
    $fh->owner_guid = $plugin->getGUID();
    $fh->setFilename('tangram.xml');
    if (!$fh->exists()) {
        // try a reload once
        haarlem_tangram_cache_xml();
    }
    if (!$fh->exists()) {
        return false;
    }
    $xml_cache = simplexml_load_file($fh->getFilenameOnFilestore());
    return $xml_cache;
}
Exemple #2
0
/**
 * Listen to the cron handlers
 *
 * @param string $hook         the name of the hook
 * @param string $type         the type of the hook
 * @param mixed  $return_value current return value
 * @param array  $params       supplied params
 *
 * @return void
 */
function haarlem_tangram_hourly_cron_handler($hook, $type, $return_value, $params)
{
    // cache the tangram XML
    haarlem_tangram_cache_xml();
}