/** * Load plugins * * Loads in the activated plugins data then loads the plugins. */ function lilina_plugins_init() { $data = new DataHandler(); $plugins = $data->load('plugins.data'); if ($plugins === null) { return; } $plugins = unserialize($plugins); if (!is_array($plugins) || empty($plugins)) { return; } foreach ($plugins as $plugin) { if ('' !== $plugin && file_exists(LILINA_CONTENT_DIR . '/plugins/' . $plugin)) { include_once LILINA_CONTENT_DIR . '/plugins/' . $plugin; } } global $current_plugins; $current_plugins = $plugins; }
/** * Load feeds into global $data * * @uses $data * @return array */ function load_feeds() { global $data; $file = new DataHandler(LILINA_CONTENT_DIR . '/system/config/'); $data = $file->load('feeds.data'); if ($data !== null) { $data = unserialize(base64_decode($data)); } else { $data = array(); } return $data; }
//Settings that use other settings variables if (!defined('LILINA_CONTENT_DIR')) { define('LILINA_CONTENT_DIR', LILINA_PATH . '/content'); } if (!defined('LILINA_CACHE_DIR')) { define('LILINA_CACHE_DIR', LILINA_CONTENT_DIR . '/system/cache/'); } if (!defined('LILINA_DATA_DIR')) { define('LILINA_DATA_DIR', LILINA_CONTENT_DIR . '/system/data/'); } if (!isset($settings['files'])) { $settings['files'] = array('feeds' => LILINA_CONTENT_DIR . '/system/config/feeds.data', 'options' => LILINA_CONTENT_DIR . '/system/config/options.data', 'settings' => LILINA_CONTENT_DIR . '/system/config/settings.php', 'plugins' => LILINA_CONTENT_DIR . '/system/config/plugins.data'); } global $options; $data = new DataHandler(LILINA_CONTENT_DIR . '/system/config/'); $options = $data->load('options.data'); if ($options !== null) { $options = unserialize($options); } else { $options = array(); } if (!isset($options['cachedir'])) { $options['cachedir'] = LILINA_CACHE_DIR; } } /** * Attempt to load the class before PHP fails with an error. * * This method is called automatically in case you are trying to use a class which hasn't been defined yet. * @param string $class_name Class called by the user */
/** * Remove a feed * * @param string $id ID of the feed to remove * @return bool */ public function delete($id) { if (empty($this->feeds[$id])) { throw new Exception(_r('Feed does not exist'), Errors::get_code('admin.feeds.invalid_id')); } //Make a copy for later. $removed = $this->feeds[$id]; $removed = apply_filters('feed-delete', $removed); $cache = new DataHandler(get_option('cachedir')); if ($cache->load($id . '.ico') !== null) { $cache->delete($id . '.ico'); } unset($this->feeds[$id]); $this->save(); return sprintf(_r('Removed "%1$s" — <a href="%2$s">Undo</a>?'), $removed['name'], 'feeds.php?action=add&add_name=' . urlencode($removed['name']) . '&add_url=' . urlencode($removed['feed']) . '&id=' . urlencode($removed['id'])); }
/** * @todo Document * @author WordPress */ function update_nag() { $data = new DataHandler(); $cur = $data->load('core-update-check.data'); if ($cur === null) { return false; } $cur = unserialize($cur); if (!isset($cur->response) || $cur->response != 'upgrade') { return false; } $msg = sprintf(_r('Lilina %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->version, $cur->url); echo "<div id='update-nag' class='message'>{$msg}</div>"; }