本文整理汇总了PHP中DataHandler::load方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::load方法的具体用法?PHP DataHandler::load怎么用?PHP DataHandler::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lilina_plugins_init
/**
* 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;
}
示例2: load_feeds
/**
* 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;
}
示例3: define
//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
*/
示例4: delete
/**
* 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']));
}
示例5: update_nag
/**
* @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>";
}