本文整理汇总了PHP中debug_event函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_event函数的具体用法?PHP debug_event怎么用?PHP debug_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_store
public static function get_store()
{
$store = null;
$store_path = AmpConfig::get('tmp_dir_path');
if (empty($store_path)) {
if (function_exists('sys_get_temp_dir')) {
$store_path = sys_get_temp_dir();
} else {
if (strpos(PHP_OS, 'WIN') === 0) {
$store_path = $_ENV['TMP'];
if (!isset($store_path)) {
$store_path = 'C:\\Windows\\Temp';
}
} else {
$store_path = @$_ENV['TMPDIR'];
if (!isset($store_path)) {
$store_path = '/tmp';
}
}
}
$store_path .= DIRECTORY_SEPARATOR . '_openid';
}
if (empty($store_path) || !file_exists($store_path) && !mkdir($store_path)) {
debug_event('openid', 'Could not access/create the FileStore directory ' . $store_path . '. Please check the effective permissions.', '5');
} else {
$store = new Auth_OpenID_FileStore($store_path);
return $store;
}
return $store;
}
示例2: get_themes
/**
* get_themes
* this looks in /themes and pulls all of the
* theme.cfg.php files it can find and returns an
* array of the results
*/
function get_themes()
{
/* Open the themes dir and start reading it */
$handle = opendir(AmpConfig::get('prefix') . '/themes');
if (!is_resource($handle)) {
debug_event('theme', 'Failed to open /themes directory', 2);
return array();
}
$results = array();
$theme_cfg = '/theme.cfg.php';
while (($f = readdir($handle)) !== false) {
debug_event('theme', "Checking {$f}", 5);
$file = AmpConfig::get('prefix') . '/themes/' . $f;
if (file_exists($file . $theme_cfg)) {
debug_event('theme', "Loading {$theme_cfg} from {$f}", 5);
$r = parse_ini_file($file . $theme_cfg);
$r['path'] = $f;
$results[$r['name']] = $r;
} else {
debug_event('theme', "{$theme_cfg} not found in {$f}", 5);
}
}
// end while directory
// Sort by the theme name
ksort($results);
return $results;
}
示例3: get_theme
function get_theme($name)
{
static $_mapcache = array();
if (strlen($name) < 1) {
return false;
}
$name = strtolower($name);
if (isset($_mapcache[$name])) {
return $_mapcache[$name];
}
$config_file = AmpConfig::get('prefix') . "/themes/" . $name . "/theme.cfg.php";
if (file_exists($config_file)) {
$results = parse_ini_file($config_file);
$results['path'] = $name;
$results['base'] = explode(',', $results['base']);
$nbbases = count($results['base']);
for ($i = 0; $i < $nbbases; $i++) {
$results['base'][$i] = explode('|', $results['base'][$i]);
}
$results['colors'] = explode(',', $results['colors']);
} else {
debug_event('theme', $config_file . ' not found.', 3);
$results = null;
}
$_mapcache[$name] = $results;
return $results;
}
示例4: set
/**
* set
*
* This sets config values.
*/
public static function set($name, $value, $clobber = false)
{
if (isset(self::$_global[$name]) && !$clobber) {
debug_event('Config', "Tried to overwrite existing key {$name} without setting clobber", 5);
Error::add('Config Global', sprintf(T_('Trying to clobber \'%s\' without setting clobber'), $name));
return false;
}
self::$_global[$name] = $value;
}
示例5: insert
/**
* insert
* This inserts a new record for the specified object
* with the specified information, amazing!
*/
public static function insert($type, $oid, $user, $agent = '')
{
$type = self::validate_type($type);
$sql = "INSERT INTO `object_count` (`object_type`,`object_id`,`date`,`user`,`agent`) " . " VALUES (?, ?, ?, ?, ?)";
$db_results = Dba::write($sql, array($type, $oid, time(), $user, $agent));
if (!$db_results) {
debug_event('statistics', 'Unabled to insert statistics:' . $sql, '3');
}
}
示例6: insert
/**
* insert
*
* This inserts the song preview described by the passed array
*/
public static function insert($results)
{
$sql = 'INSERT INTO `song_preview` (`file`, `album_mbid`, `artist`, `artist_mbid`, `title`, `disk`, `track`, `mbid`, `session`) ' . ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
$db_results = Dba::write($sql, array($results['file'], $results['album_mbid'], $results['artist'], $results['artist_mbid'], $results['title'], $results['disk'], $results['track'], $results['mbid'], $results['session']));
if (!$db_results) {
debug_event('song_preview', 'Unable to insert ' . $results[''], 2);
return false;
}
return Dba::insert_id();
}
示例7: getChild
public function getChild($name)
{
debug_event('webdav', 'Catalog getChild for `' . $name . '`', 5);
$matches = Catalog::search_childrens($name, $this->catalog_id);
debug_event('webdav', 'Found ' . count($matches) . ' childs.', 5);
// Always return first match
// Warning: this means that two items with the same name will not be supported for now
if (count($matches) > 0) {
return WebDAV_Directory::getChildFromArray($matches[0]);
}
throw new DAV\Exception\NotFound('The artist with name: ' . $name . ' could not be found');
}
示例8: get
public function get()
{
debug_event('webdav', 'File get', 5);
// Only media associated to a local catalog is supported
if ($this->libitem->catalog) {
$catalog = Catalog::create_from_id($this->libitem->catalog);
if ($catalog->get_type() === 'local') {
return fopen($this->libitem->file, 'r');
} else {
debug_event('webdav', 'Catalog associated to the media is not local. This is currently unsupported.', 3);
}
} else {
debug_event('webdav', 'No catalog associated to the media.', 3);
}
return null;
}
示例9: gc
/**
* gc
*
* Remove bookmark for items that no longer exist.
*/
public static function gc($object_type = null, $object_id = null)
{
$types = array('song', 'video', 'podcast_episode');
if ($object_type != null) {
if (in_array($object_type, $types)) {
$sql = "DELETE FROM `bookmark` WHERE `object_type` = ? AND `object_id` = ?";
Dba::write($sql, array($object_type, $object_id));
} else {
debug_event('bookmark', 'Garbage collect on type `' . $object_type . '` is not supported.', 1);
}
} else {
foreach ($types as $type) {
Dba::write("DELETE FROM `bookmark` USING `bookmark` LEFT JOIN `{$type}` ON `{$type}`.`id` = `bookmark`.`object_id` WHERE `bookmark`.`object_type` = '{$type}' AND `{$type}`.`id` IS NULL");
}
}
}
示例10: gc
/**
* gc
*
* Cleans out orphaned shoutbox items
*/
public static function gc($object_type = null, $object_id = null)
{
$types = array('song', 'album', 'artist', 'label');
if ($object_type != null) {
if (in_array($object_type, $types)) {
$sql = "DELETE FROM `user_shout` WHERE `object_type` = ? AND `object_id` = ?";
Dba::write($sql, array($object_type, $object_id));
} else {
debug_event('shoutbox', 'Garbage collect on type `' . $object_type . '` is not supported.', 1);
}
} else {
foreach ($types as $type) {
Dba::write("DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `{$type}` ON `{$type}`.`id` = `user_shout`.`object_id` WHERE `{$type}`.`id` IS NULL AND `user_shout`.`object_type` = '{$type}'");
}
}
}
示例11: getChild
public function getChild($name)
{
// Clean song name
if (strtolower(get_class($this->libitem)) === "album") {
$splitname = explode('-', $name, 3);
$name = trim($splitname[count($splitname) - 1]);
$nameinfo = pathinfo($name);
$name = $nameinfo['filename'];
}
debug_event('webdav', 'Directory getChild: ' . $name, 5);
$matches = $this->libitem->search_childrens($name);
// Always return first match
// Warning: this means that two items with the same name will not be supported for now
if (count($matches) > 0) {
return WebDAV_Directory::getChildFromArray($matches[0]);
}
throw new DAV\Exception\NotFound('The child with name: ' . $name . ' could not be found');
}
示例12: get_images
protected static function get_images($artist_name)
{
$images = array();
if (AmpConfig::get('echonest_api_key')) {
$echonest = new EchoNest_Client(new EchoNest_HttpClient_Requests());
$echonest->authenticate(AmpConfig::get('echonest_api_key'));
try {
$images = $echonest->getArtistApi()->setName($artist_name)->getImages();
} catch (Exception $e) {
debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
}
}
foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$images += $plugin->_plugin->get_photos($artist_name);
}
}
return $images;
}
示例13: parseDescriptionUrl
private function parseDescriptionUrl($descriptionUrl)
{
debug_event('upnpdevice', 'parseDescriptionUrl: ' . $descriptionUrl, 5);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $descriptionUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
//!!debug_event('upnpdevice', 'parseDescriptionUrl response: ' . $response, 5);
$responseXML = simplexml_load_string($response);
$services = $responseXML->device->serviceList->service;
foreach ($services as $service) {
$serviceType = $service->serviceType;
$serviceTypeNames = explode(":", $serviceType);
$serviceTypeName = $serviceTypeNames[3];
$this->_settings['controlURLs'][$serviceTypeName] = (string) $service->controlURL;
$this->_settings['eventURLs'][$serviceTypeName] = (string) $service->eventSubURL;
}
$urldata = parse_url($descriptionUrl);
$this->_settings['host'] = $urldata['scheme'] . '://' . $urldata['host'] . ':' . $urldata['port'];
$this->_settings['descriptionURL'] = $descriptionUrl;
Session::create(array('type' => 'api', 'sid' => 'upnp_dev_' . $descriptionUrl, 'value' => serialize($this->_settings)));
}
示例14: delete_track
/**
* delete_track
* This must take an array of ID's (as passed by get function) from Ampache
* and delete them from vlc webinterface
*/
public function delete_track($object_id)
{
if (is_null($this->_vlc->delete_pos($object_id))) {
debug_event('vlc_del', 'ERROR Unable to delete ' . $object_id . ' from Vlc', '1');
return false;
}
return true;
}
示例15: gather_lastfm
/**
* gather_lastfm
* This returns the art from lastfm. It doesn't currently require an
* account but may in the future.
* @param int $limit
* @param array $data
* @return array
*/
public function gather_lastfm($limit = 5, $data = array())
{
if (!$limit) {
$limit = 5;
}
$images = array();
if ($this->type != 'album' || empty($data['artist']) || empty($data['album'])) {
return $images;
}
try {
$xmldata = Recommendation::album_search($data['artist'], $data['album']);
if (!count($xmldata)) {
return array();
}
$xalbum = $xmldata->album;
if (!$xalbum) {
return array();
}
$coverart = (array) $xalbum->image;
if (!$coverart) {
return array();
}
ksort($coverart);
foreach ($coverart as $url) {
// We need to check the URL for the /noimage/ stuff
if (is_array($url) || strpos($url, '/noimage/') !== false) {
debug_event('LastFM', 'Detected as noimage, skipped ' . $url, 3);
continue;
}
// HACK: we shouldn't rely on the extension to determine file type
$results = pathinfo($url);
$mime = 'image/' . $results['extension'];
$images[] = array('url' => $url, 'mime' => $mime, 'title' => 'LastFM');
if ($limit && count($images) >= $limit) {
return $images;
}
}
// end foreach
} catch (Exception $e) {
debug_event('art', 'LastFM error: ' . $e->getMessage(), 5);
}
return $images;
}