本文整理汇总了PHP中X_Debug::w方法的典型用法代码示例。如果您正苦于以下问题:PHP X_Debug::w方法的具体用法?PHP X_Debug::w怎么用?PHP X_Debug::w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X_Debug
的用法示例。
在下文中一共展示了X_Debug::w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_beforePageBuild
function gen_beforePageBuild(Zend_Controller_Action $controller)
{
$moduleName = $controller->getRequest()->getModuleName();
$controllerName = $controller->getRequest()->getControllerName();
$actionName = $controller->getRequest()->getActionName();
$providerName = $controller->getRequest()->getParam('p', false);
// check permission class
if ($controllerName == 'browse' && $actionName == 'share') {
// check provider too only if controller == browse
$resourceKey = "{$moduleName}/{$controllerName}/{$actionName}" . ($providerName !== false ? "/{$providerName}" : '');
} else {
$resourceKey = "{$moduleName}/{$controllerName}/{$actionName}";
}
// TODO:
// replace this with an ACL call:
// if ( !$acl->canUse($resource, $currentStatus) )
if (array_search("{$moduleName}/{$controllerName}/{$actionName}", $this->_whiteList) === false) {
if (!$this->isLoggedIn()) {
X_Debug::i("Login required and user not logged in");
if ($this->helpers()->devices()->isVlc()) {
X_Debug::i("Look like it's this vlc: {$_SERVER['REMOTE_ADDR']}");
if (gethostbyname($_SERVER['REMOTE_ADDR']) == '::1' || gethostbyname($_SERVER['REMOTE_ADDR']) == '127.0.0.1') {
X_Debug::i("Skipping auth, it should be the local vlc");
return;
}
} elseif ($this->helpers()->devices()->isWiimc() && $this->helpers()->devices()->isWiimcBeforeVersion('1.1.6')) {
// wiimc <= 1.1.5 send 2 different user-agent string
// for browsing mode and video mode
// so i have care about this
// TODO remove this when 1.1.5 an older will be deprecated
// anyway i take care only of vanilla wiimc based on ios58. custom version
// not supported
$useragent = "{$_SERVER['HTTP_USER_AGENT']} (IOS58)";
// try to add " (ISO58)" to the useragent and check again
if (Application_Model_AuthSessionsMapper::i()->fetchByIpUserAgent($_SERVER['REMOTE_ADDR'], $useragent)) {
X_Debug::i("Workaround for WIIMC user-agent-incongruence");
return;
}
} elseif ($this->helpers()->acl()->canUseAnonymously($resourceKey)) {
X_Debug::i("Resource can be used anonymously");
return;
}
X_Debug::w("Auth required, redirecting to login");
$controller->getRequest()->setControllerName("auth")->setActionName('index')->setDispatched(false);
} elseif ($this->config('acl.enabled', false)) {
X_Debug::i("ACL enabled, checking resource {{$resourceKey}}");
$username = $this->getCurrentUser(true);
if (!$this->helpers()->acl()->canUse($username, $resourceKey)) {
X_Debug::w("Forbidden, can't access resource");
$controller->getRequest()->setControllerName("auth")->setActionName('forbidden')->setDispatched(false);
} else {
X_Debug::i("Access granted");
}
} else {
X_Debug::i("ACL disabled");
}
} else {
X_Debug::i("Whitelisted resource");
}
}
示例2: parse
public function parse($string)
{
$parsed = array();
switch ($this->function) {
case self::PREG_MATCH:
if (@preg_match($this->pattern, $string, $parsed, $this->flags) === false) {
X_Debug::w("Invalid pattern (" . preg_last_error() . "): {$this->pattern}");
$parsed = array();
}
break;
case self::PREG_MATCH_ALL:
if (@preg_match_all($this->pattern, $string, $parsed, $this->flags) === false) {
X_Debug::w("Invalid pattern (" . preg_last_error() . "): {$this->pattern}");
$parsed = array();
}
break;
case self::PREG_SPLIT:
$parsed = @preg_split($this->pattern, $string, null, $this->flags);
if ($parsed === false) {
X_Debug::w("Invalid pattern (" . preg_last_error() . "): {$this->pattern}");
$parsed = array();
}
break;
default:
X_Debug::e("Invalid function code provided: {$this->function}");
}
return $parsed;
}
示例3: lazyInit
/**
* Execute vlcwrapper initialization on the first request
*/
private function lazyInit()
{
if ($this->_initialized === false) {
$options = $this->options;
$adapterConf = $options->get('adapter', new Zend_Config(array()));
$adapter = $adapterConf->get('name', "X_Vlc_Adapter_" . (X_Env::isWindows() ? 'Windows' : 'Linux'));
X_Debug::i("Adapter: {$adapter}");
$this->adapter = new $adapter($options);
$commanderConf = $options->get('commander', new Zend_Config(array()));
$commander = $commanderConf->get('name', '');
$commanderPath = $commanderConf->get('path', '');
if ($commanderPath != '' && file_exists($commanderPath)) {
X_Debug::i("Including commanderPath: {$commanderPath}");
include_once $commanderPath;
}
if (class_exists($commander, true) && array_key_exists('X_Vlc_Commander', class_parents($commander))) {
X_Debug::i("Commander: {$commander}");
$commander = new $commander($options);
$this->adapter->setCommander($commander);
} else {
X_Debug::w("Commander: no selection");
}
$this->_conf_vlcArgs = $options->get('args', "{%source%} --play-and-exit --sout=\"#{%profile%}:{%output%}\" --sout-keep {%subtitles%} {%audio%} {%filters%}");
$this->_conf_vlcPath = $options->get('path', "vlc");
$this->_initialized = true;
}
}
示例4: spawn
function spawn($threadId)
{
$http = new Zend_Http_Client($this->url, array('timeout' => 3, 'keepalive' => false));
$i = 20;
do {
if ($i-- < 0) {
throw new Exception("To many hash generation failed");
}
$salt = rand(1, 1000);
$key = time();
$privKey = rand(100000, 999999);
$hash = md5("{$salt}{$privKey}{$key}");
} while (!$this->storeRequestKey($hash, $privKey));
$http->setParameterPost('hash', $hash)->setParameterPost('key', $key)->setParameterPost('salt', $salt)->setParameterPost('thread', $threadId);
try {
$body = $http->request(Zend_Http_Client::POST)->getBody();
$response = @Zend_Json::decode($body);
if ($response) {
return @$response['success'];
}
} catch (Exception $e) {
// timeout
// don't know, assume true
X_Debug::w("Request timeout");
return true;
}
}
示例5: processProperties
protected function processProperties($properties = array())
{
if (!is_array($properties)) {
X_Debug::e("Properties is not an array");
return;
}
foreach ($properties as $key => $value) {
$properties_ignored = true;
// prot-type is valid
if (isset(self::$validProperties[$key])) {
// check value
$validValues = self::$validProperties[$key];
@(list($typeValidValues, $validValues) = @explode(':', $validValues, 2));
// typeValidValues = boolean / regex / set / ...
switch ($typeValidValues) {
case 'boolean':
$checkValues = array('true', 'false', '0', '1');
if (array_search($value, $checkValues)) {
// cast to type
$value = (bool) $value;
$properties_ignored = false;
} else {
$properties_ignored = "invalid property value {{$value}}, not boolean";
}
break;
case 'set':
$checkValues = explode('|', $validValues);
if (array_search($value, $checkValues)) {
$properties_ignored = false;
} else {
$properties_ignored = "invalid property value {{$value}}, not in valid set";
}
break;
case 'regex':
if (preg_match($validValues, $value)) {
$properties_ignored = false;
} else {
$properties_ignored = "invalid property value {{$value}}, format not valid";
}
break;
}
} else {
$properties_ignored = "invalid property";
}
if ($properties_ignored !== false) {
X_Debug::w("Property {{$key}} of acl-resource {{$this->getKey()}} ignored: " . $properties_ignored !== true ? $properties_ignored : 'unknown reason');
} else {
X_Debug::i("Valid property for acl-resource {{$this->getKey()}}: {$key} => {{$value}}");
$this->properties[$key] = $value;
}
}
}
示例6: orderShareItems
/**
* Sorts items:
* if provider is FileSystem uses a folder/file sort
* else alphabetical one
* @param array &$items array of X_Page_Item_PItem
* @param string $provider id of the plugin the handle the request
* @param Zend_Controller_Action $controller
*/
public function orderShareItems(&$items, $provider, Zend_Controller_Action $controller)
{
X_Debug::i('Plugin triggered');
try {
$plugin = X_VlcShares_Plugins::broker()->getPlugins($provider);
// TODO check for problem if i always use sortFolderBased
if (true || is_a($plugin, 'X_VlcShares_Plugins_FileSystem')) {
X_Debug::i('Sort sortFolderBased');
usort($items, array(__CLASS__, 'sortFolderBased'));
} else {
X_Debug::i('Sort generic');
usort($items, array(__CLASS__, 'sortAlphabetically'));
}
} catch (Exception $e) {
X_Debug::w("Problem while sorting: {$e->getMessage()}");
}
}
示例7: getPlayable
/**
* get a playable resource url
* from an $url (or a resource id if $isId = true)
* @param string $url the hoster page or resource ID
* @param boolean $isId
* @return string a playable url
*/
function getPlayable($url, $isId = true)
{
if (!$isId) {
$url = $this->getResourceId($url);
}
// $url is an id now for sure
/* @var $youtubeHelper X_VlcShares_Plugins_Helper_Youtube */
$youtubeHelper = X_VlcShares_Plugins::helpers()->helper('youtube');
/* @var $youtubePlugin X_VlcShares_Plugins_Youtube */
$youtubePlugin = X_VlcShares_Plugins::broker()->getPlugins('youtube');
X_Debug::i("Youtube ID: {$url}");
// THIS CODE HAVE TO BE MOVED IN YOUTUBE HELPER
// FIXME
$formats = $youtubeHelper->getFormatsNOAPI($url);
$returned = null;
$qualityPriority = explode('|', $youtubePlugin->config('quality.priority', '5|34|18|35'));
foreach ($qualityPriority as $quality) {
if (array_key_exists($quality, $formats)) {
$returned = $formats[$quality];
X_Debug::i('Video format selected: ' . $quality);
break;
}
}
if ($returned === null) {
// for valid video id but video with restrictions
// alternatives formats can't be fetched by youtube page.
// i have to fallback to standard api url
$apiVideo = $youtubeHelper->getVideo($url);
foreach ($apiVideo->mediaGroup->content as $content) {
if ($content->type === "video/3gpp") {
$returned = $content->url;
X_Debug::w('Content restricted video, fallback to api url:' . $returned);
break;
}
}
if ($returned === null) {
$returned = false;
}
}
if ($returned !== false && $returned !== null) {
// valid return
return $returned;
}
throw new Exception("Invalid video", self::E_ID_INVALID);
}
示例8: addTranslation
public function addTranslation($key)
{
$moduleName = $key . '.' . $this->lang;
// i have to check $moduleName to be sure that the file is inside the languages/ directory
if (file_exists(realpath(APPLICATION_PATH . "/../languages/{$moduleName}"))) {
$translate = new Zend_Translate('ini', realpath(APPLICATION_PATH . "/../languages/{$moduleName}"));
} elseif ($this->lang != 'en_GB.ini' && file_exists(realpath(APPLICATION_PATH . "/../languages/{$key}.en_GB.ini"))) {
// fallback to english translation
X_Debug::w("Language file not found: {$moduleName}. Falling back to english translation");
$translate = new Zend_Translate('ini', realpath(APPLICATION_PATH . "/../languages/{$key}.en_GB.ini"));
} else {
X_Debug::w("Language file not found: {$moduleName}");
return false;
}
// time to append translator to the global instance
X_Env::initTranslator($translate);
return true;
}
示例9: filterShareItems
/**
* Return true if $item is an hidden file or system file (check configs)
* @param X_Page_Item_PItem $item
* @param string $provider
* @param Zend_Controller_Action $controller
* @return boolean|null true or null if file is ok, false otherwise (will be filtered out)
*/
public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller)
{
try {
$plugin = X_VlcShares_Plugins::broker()->getPlugins($provider);
if (is_a($plugin, 'X_VlcShares_Plugins_FileSystem') && $plugin instanceof X_VlcShares_Plugins_ResolverInterface) {
// i use instanceof ResolverInterface
// so i have code suggestions
// X_VlcShares_Plugins_FileSystem register a custom param in item
// for location lookup
$location = $plugin->resolveLocation($item->getCustom('X_VlcShares_Plugins_FileSystem:location'));
// i must check for $location !== false as a fallback for no custom param case
if ($location !== false && file_exists($location)) {
// i have a location to check for hidden files:
if ($this->_checkEntry($location) === false) {
X_Debug::i("Plugin triggered, item filtered: {$location}");
return false;
}
}
//X_Debug::i('Plugin triggered');
}
} catch (Exception $e) {
X_Debug::w("Problem while filtering: {$e->getMessage()}");
}
}
示例10: getPositions
public function getPositions($location, $sourceFile)
{
$positions = array();
try {
/* @var $cacheHelper X_VlcShares_Plugins_Helper_Cache */
$cacheHelper = X_VlcShares_Plugins::helpers('cache');
$positions = $cacheHelper->retrieveItem("streamseeker::{$location}");
if ($positions) {
$positions = @unserialize($positions);
}
X_Debug::i("Using positions values stored in cache about {$location}");
// return stored values
return $positions;
} catch (Exception $e) {
// no cache plugin or no positions cached
X_Debug::i("No FLV info in cache about {$location}");
}
// dump 9kb of the file to analyze it
$tmpFile = tempnam(sys_get_temp_dir(), 'fia');
$sampleSize = intval($this->options->get('samplesize', 100)) * 1000;
X_Debug::i("Downloading {$sampleSize} bytes in {$tmpFile} from {$sourceFile}");
$src = fopen($sourceFile, 'r');
$dest = fopen($tmpFile, 'w');
$copied = stream_copy_to_stream($src, $dest, $sampleSize);
fclose($src);
fclose($dest);
X_Debug::i("{$copied} bytes downloaded");
try {
$flvinfo = new X_FLVInfo();
$fileInfo = $flvinfo->getInfo($tmpFile, true, true);
if ($fileInfo->signature) {
$keyframes = @$fileInfo->rawMeta[1]['keyframes'];
$times = $keyframes->times;
$filepositions = $keyframes->filepositions;
$lastAdd = 0;
//$firstKey = 0;
$minDelta = intval($this->options->get('mindelta', 5)) * 60;
// mindelta is in minutes
// time to parse and filter the response
// filter using a minDelta function
foreach ($times as $key => $seconds) {
/*
if ( $key == 0 ) {
$firstKey = $filepositions[$key];
continue;
}*/
if ($seconds - $lastAdd > $minDelta) {
// new step
//$positions["{$filepositions[$key]},{$firstKey}"] = X_Env::formatTime(intval($seconds));
$positions[$filepositions[$key]] = X_Env::formatTime(intval($seconds));
$lastAdd = intval($seconds);
}
}
X_Debug::i("Valid position found in flv file: " . count($positions));
// parse done, store
try {
/* @var $cacheHelper X_VlcShares_Plugins_Helper_Cache */
$cacheHelper = X_VlcShares_Plugins::helpers('cache');
$cacheHelper->storeItem("streamseeker::{$location}", serialize($positions), $this->options->get('cachevalidity', 10));
} catch (Exception $e) {
X_Debug::e("Cache is disabled. This is really bad for streamseeker");
}
} else {
X_Debug::w("Wrong signature. Can't analyze");
}
} catch (Exception $e) {
X_Debug::e("FLVInfo throws an error: {$e->getMessage()}");
}
return $positions;
}
示例11: _fetch
protected function _fetch()
{
if ($this->_location == null) {
X_Debug::w('Trying to fetch a megavideo location without a location');
throw new Exception('Trying to fetch a megavideo location without a location');
}
if ($this->_fetched === false) {
$this->_fetched = new X_Megavideo($this->_location);
$this->_cachedSearch[$this->_location] = $this->_fetched;
}
}
示例12: getPlayableInfos
/**
* get an array with standard information about the playable
* @param string $url the hoster page or resource ID
* @param boolean $isId
* @return array format:
* array(
* 'title' => TITLE
* 'description' => DESCRIPTION
* 'length' => LENGTH
* ...
* )
*/
function getPlayableInfos($url, $isId = true)
{
if (!$isId) {
$url = $this->getResourceId($url);
}
// use cached values
if (array_key_exists($url, $this->info_cache)) {
return $this->info_cache[$url];
}
// use the api
$http = new Zend_Http_Client("http://www.sockshare.com/embed/" . $url, array('headers' => array('User-Agent' => "vlc-shares/" . X_VlcShares::VERSION . " sockshare/" . X_VlcShares_Plugins_SockShare::VERSION)));
$xml = $http->request()->getBody();
if (preg_match('/<div class\\=\\"message t_0\\">This file doesn\'t exist, or has been removed\\.<\\/div>/', $xml)) {
X_Debug::e("Invalid ID {{$url}} or file removed");
throw new Exception("Invalid ID {{$url}}", self::E_ID_INVALID);
}
$matches = array();
if (!preg_match('/<strong>(?P<title>[^<]+)<\\/strong>/', $xml, $matches)) {
$title = X_Env::_('p_sockshare_title_not_setted');
X_Debug::w("Title not found");
} else {
$title = $matches['title'];
}
$description = '';
if (!preg_match('/<input type\\=\\"hidden\\" value\\=\\"(?P<hash>[^\\"]+)\\" name\\=\\"(?P<arg>[^\\"]+)\\">/', $xml, $matches)) {
X_Debug::w("Couldn't find hash for file {{$url}}");
throw new Exception("Couldn't find hash for file {{$url}}", self::E_ID_INVALID);
}
$hash = $matches['hash'];
$arg = $matches['arg'];
// To turn cookie stickiness on, set a Cookie Jar
$http->setCookieJar();
// First request: log in and start a session
$http->setUri("http://www.sockshare.com/embed/" . $url);
$http->setParameterPost($arg, $hash);
$http->setParameterPost('confirm', 'Close Ad and Watch as Free User');
$http->request('POST');
$xml = $http->request()->getBody();
$matches = array();
if (!preg_match('/<img src="(?P<thumbnail>.+?)" name="bg" style=".+?" id="bg"\\/>/', $xml, $matches)) {
X_Debug::w("No thumbnail found");
$thumbnail = '';
} else {
$thumbnail = $matches['thumbnail'];
}
X_Debug::i("Thumbnail found {{$thumbnail}}");
$matches = array();
if (!preg_match("/playlist: '(?P<playlist>[^']+)'/", $xml, $matches)) {
$playlist = '';
X_Debug::w("Couldn't find playlist for file " . $url . "!");
throw new Exception("Couldn't find playlist for file {{$url}}", self::E_ID_INVALID);
}
$playlist = $matches['playlist'];
$http->setUri("http://www.sockshare.com" . $playlist);
$http->request('GET');
$xml = $http->request()->getBody();
$matches = array();
if (!preg_match('/<media:content url\\=\\"(?P<video>[^\\"]+)\\" type\\=\\"video\\/x-flv\\" duration\\=\\"(?P<length>[^\\"]+)\\" \\/>/', $xml, $matches)) {
X_Debug::w("Couldn't find video link for file " . $url . "!");
throw new Exception("Couldn't find video link for file {{$url}}", self::E_ID_INVALID);
}
$length = $matches['length'];
$video = $matches['video'];
$infos = array('title' => $title, 'description' => $description, 'length' => $length, 'thumbnail' => $thumbnail, 'url' => $video);
// add in cache
$this->info_cache[$url] = $infos;
return $infos;
}
示例13: removeResource
public function removeResource($key)
{
$resource = new Application_Model_AclResource();
Application_Model_AclResourcesMapper::i()->find($key, $resource);
if (!$resource->isNew()) {
try {
Application_Model_AclResourcesMapper::i()->delete($resource);
X_Debug::i("Resource removed {{$key}}");
$this->resetCached();
return true;
} catch (Exception $e) {
X_Debug::e("Error removing resource: {$e->getMessage()}");
return false;
}
} else {
X_Debug::w("Resource doesn't exists {{$key}}}");
return true;
}
}
示例14: getInfo
/**
*
*/
public function getInfo($infos = null)
{
// uso per fare il parsing
if (is_null($infos)) {
$infos = $this->_send('');
}
/**
<root>
<volume>256</volume>
<length>234</length>
<time>12</time>
<state>playing</state>
<position>5</position>
<fullscreen></fullscreen>
<random>0</random>
<loop>0</loop>
<repeat>0</repeat>
<information>
<category name="Diffusione 0">
<info name="Tipo">Video</info>
<info name="Codifica">XVID</info>
<info name="Risoluzione">720x576</info>
<info name="Risoluzione video">720x576</info>
<info name="Immagini al secondo">25</info>
</category>
<category name="Diffusione 1">
<info name="Tipo">Audio</info>
<info name="Codifica">mpga</info>
<info name="Canali">Mono</info>
<info name="Campionamento">48000 Hz</info>
<info name="Bitrate">80 kb/s</info>
</category>
<meta-information>
<title><![CDATA[/media/Windows/video.avi]]></title>
<artist><![CDATA[]]></artist>
<genre><![CDATA[]]></genre>
<copyright><![CDATA[]]></copyright>
<album><![CDATA[]]></album>
<track><![CDATA[]]></track>
<description><![CDATA[]]></description>
<rating><![CDATA[]]></rating>
<date><![CDATA[]]></date>
<url><![CDATA[]]></url>
<language><![CDATA[]]></language>
<now_playing><![CDATA[]]></now_playing>
<publisher><![CDATA[]]></publisher>
<encoded_by><![CDATA[]]></encoded_by>
<art_url><![CDATA[]]></art_url>
<track_id><![CDATA[]]></track_id>
</meta-information>
</information>
<stats>
<readbytes>1498004</readbytes>
<inputbitrate>0,107826</inputbitrate>
<demuxreadbytes>1335729</demuxreadbytes>
<demuxbitrate>0,139785</demuxbitrate>
<decodedvideo>166</decodedvideo>
<displayedpictures>467</displayedpictures>
<lostpictures>27</lostpictures>
<decodedaudio>528</decodedaudio>
<playedabuffers>528</playedabuffers>
<lostabuffers>3</lostabuffers>
<sentpackets>0</sentpackets>
<sentbytes>0</sentbytes>
<sendbitrate>0,000000</sendbitrate>
</stats>
</root>
*/
$rInfos = array();
try {
$dom = new Zend_Dom_Query($infos);
// lunghezza
$results = $dom->queryXpath('/root/length');
if (count($results) > 0) {
$rInfos['length'] = $results->current()->nodeValue;
}
// posizione ora
$results = $dom->queryXpath('/root/time');
if (count($results) > 0) {
$rInfos['time'] = $results->current()->nodeValue;
}
// posizione name
//.........这里部分代码省略.........
示例15: _disableRendering
/**
* Disable layout and viewRenderer
* @param Zend_Controller_Action $controller
*/
private function _disableRendering(Zend_Controller_Action $controller)
{
try {
$controller->getHelper('viewRenderer')->setNoRender(true);
// disableLayout must be called at the end
// i don't know if layout is enabled
// and maybe an exception is raised if
// i call e disableLayout without layout active
$controller->getHelper('layout')->disableLayout();
} catch (Exception $e) {
X_Debug::w("Unable to disable viewRenderer or Layout: {$e->getMessage()}");
}
}