本文整理汇总了PHP中X_Debug类的典型用法代码示例。如果您正苦于以下问题:PHP X_Debug类的具体用法?PHP X_Debug怎么用?PHP X_Debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了X_Debug类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:28,代码来源:Preg.php
示例2: gen_beforePageBuild
/**
* Redirect to controls if vlc is running
* @param Zend_Controller_Action $controller
*/
public function gen_beforePageBuild(Zend_Controller_Action $controller)
{
/*
$vlc = X_Vlc::getLastInstance();
if ( $vlc === null ) {
X_Debug::i("No vlc instance");
return;
}
*/
$controllerName = $controller->getRequest()->getControllerName();
$actionName = $controller->getRequest()->getActionName();
$query = "{$controllerName}/{$actionName}";
X_Debug::i("Plugin triggered for: {$query}");
//$isRunning = $vlc->isRunning();
$isRunning = X_Streamer::i()->isStreaming();
if (array_search($query, $this->redirectCond_To) !== false && $isRunning) {
$controller->getRequest()->setControllerName('controls')->setActionName('control')->setDispatched(false);
X_Debug::i("Redirect to controls/control");
} elseif (array_search($query, $this->redirectCond_Away) !== false && !$isRunning) {
X_Debug::i("Redirect to index/collections");
$controller->getRequest()->setControllerName('index')->setActionName('collections')->setDispatched(false);
} else {
X_Debug::i("No redirection: vlc is running? " . ($isRunning ? 'Yes' : 'No'));
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:30,代码来源:RedirectControls.php
示例3: 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;
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:27,代码来源:HttpPost.php
示例4: getStreamItems
/**
* Add the go to stream link (only if engine is rtmpdump)
*
* @param X_Streamer_Engine $engine selected streamer engine
* @param string $uri
* @param string $provider id of the plugin that should handle request
* @param string $location to stream
* @param Zend_Controller_Action $controller the controller who handle the request
* @return X_Page_ItemList_PItem
*/
public function getStreamItems(X_Streamer_Engine $engine, $uri, $provider, $location, Zend_Controller_Action $controller)
{
// ignore the call if streamer is not rtmpdump
if (!$engine instanceof X_Streamer_Engine_RtmpDump) {
return;
}
X_Debug::i('Plugin triggered');
$return = new X_Page_ItemList_PItem();
$outputLink = "http://{%SERVER_NAME%}:{$this->helpers()->rtmpdump()->getStreamPort()}/";
$outputLink = str_replace(array('{%SERVER_IP%}', '{%SERVER_NAME%}'), array($_SERVER['SERVER_ADDR'], strstr($_SERVER['HTTP_HOST'], ':') ? strstr($_SERVER['HTTP_HOST'], ':') : $_SERVER['HTTP_HOST']), $outputLink);
$item = new X_Page_Item_PItem($this->getId(), X_Env::_('p_outputs_gotostream'));
$item->setType(X_Page_Item_PItem::TYPE_PLAYABLE)->setIcon('/images/icons/play.png')->setLink($outputLink);
$return->append($item);
/*
$item = new X_Page_Item_PItem('controls-stop', X_Env::_('p_controls_stop'));
$item->setType(X_Page_Item_PItem::TYPE_ELEMENT)
->setIcon('/images/icons/stop.png')
->setLink(array(
'controller' => 'controls',
'action' => 'execute',
'a' => 'stop',
'pid' => $this->getId(),
), 'default', false);
$return->append($item);
*/
return $return;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:38,代码来源:RtmpDump.php
示例5: errorAction
public function errorAction()
{
$errors = $this->_getParam('error_handler');
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
/*
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception);
}
*/
X_Debug::f($this->view->message . ": " . $errors->exception->getMessage());
X_Debug::f($errors->exception->getTraceAsString());
// conditionally display exceptions
//if ($this->getInvokeArg('displayExceptions') == true ) {
$this->view->exception = $errors->exception;
//}
$this->view->request = $errors->request;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:31,代码来源:ErrorController.php
示例6: removeAction
function removeAction()
{
$id = $this->getRequest()->getParam('id', false);
$csrf = $this->getRequest()->getParam('csrf', false);
if (!$id) {
throw new Exception("Thread id missing");
}
$hash = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
if (!$hash->isValid($csrf)) {
throw new Exception("Invalid token");
}
$hash->initCsrfToken();
$thread = X_Threads_Manager::instance()->getMonitor()->getThread($id);
// special case for streamer
if ($thread->getId() == X_Streamer::THREAD_ID) {
X_Debug::i('Special stop');
X_Streamer::i()->stop();
} else {
X_Threads_Manager::instance()->halt($thread);
}
// wait 5 seconds
sleep(5);
X_Threads_Manager::instance()->getMessenger()->clearQueue($thread);
X_Threads_Manager::instance()->getMonitor()->removeThread($thread, true);
$this->_helper->flashMessenger(array('type' => 'success', 'text' => X_Env::_('threads_done')));
$this->_helper->redirector('index', 'tmanager');
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:27,代码来源:TmanagerController.php
示例7: getIndexMessages
/**
* Show an error if ffmpeg isn't enabled
*/
function getIndexMessages(Zend_Controller_Action $controller)
{
X_Debug::i('Plugin triggered');
$m = new X_Page_Item_Message($this->getId(), X_Env::_('p_fsthumbs_dashboardffmpegerror'));
$m->setType(X_Page_Item_Message::TYPE_ERROR);
return new X_Page_ItemList_Message(array($m));
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:10,代码来源:FsThumbs.php
示例8: 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");
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:60,代码来源:Auth.php
示例9: preDispatch
public function preDispatch()
{
X_Debug::i("Required action: [" . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . ']');
parent::preDispatch();
// call plugins trigger
// TODO check if plugin broker should be called before parent::preDispatch
X_VlcShares_Plugins::broker()->gen_beforePageBuild($this);
//$this->_helper->url->url()
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:9,代码来源:Action.php
示例10: gen_afterPageBuild
public function gen_afterPageBuild(X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
{
if (count($items->getItems()) == 0) {
X_Debug::i("Plugin triggered");
$item = new X_Page_Item_PItem('emptylists', X_Env::_('p_emptylists_moveaway'));
$item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($controller->getHelper('url')->url()));
$items->append($item);
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:9,代码来源:EmptyLists.php
示例11: gen_beforePageBuild
/**
* Redirect to controls if vlc is running
* @param Zend_Controller_Action $controller
*/
public function gen_beforePageBuild(Zend_Controller_Action $controller)
{
X_Debug::i("Plugin triggered: redirect to installer");
$controllerName = $controller->getRequest()->getControllerName();
if ($controllerName != 'installer' && $controllerName != 'error') {
//die($controllerName);
$controller->getRequest()->setControllerName('installer')->setActionName('index')->setDispatched(false);
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:13,代码来源:FirstRunSetup.php
示例12: gen_afterPageBuild
public function gen_afterPageBuild(X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
{
if ($this->helpers()->devices()->isWiimc() && $this->helpers()->devices()->isWiimcBeforeVersion('1.0.9')) {
if (count($items->getItems()) === 1) {
X_Debug::i("Plugin triggered");
$item = new X_Page_Item_PItem('workaroundwiimcplaylistitemsbug', '-- Workaround for bug in Wiimc <= 1.0.9 --');
$item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($controller->getHelper('url')->url()));
$items->append($item);
}
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:11,代码来源:WorkaroundWiimcPlaylistItemsBug.php
示例13: getPage
public function getPage($uri)
{
// http hold all info about the last request and last response object as well as all options
if ($this->last_request_uri != $uri) {
$this->last_request_uri = $uri;
X_Debug::i("Fetching: {$uri}");
$this->getHttpClient()->setUri($uri)->request();
//X_Debug::i("Request: \n".$this->getHttpClient()->getLastRequest());
}
return $this->getHttpClient()->getLastResponse()->getBody();
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:11,代码来源:Http.php
示例14: indexAction
public function indexAction()
{
// uses the device helper for wiimc recognition
// maybe i will add a trigger here
if (X_VlcShares_Plugins::helpers()->devices()->isWiimc()) {
// wiimc 1.0.9 e inferiori nn accetta redirect
X_Debug::i("Forwarding...");
$this->_forward('collections', 'index');
} else {
$this->_helper->redirector('index', 'manage');
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:12,代码来源:IndexController.php
示例15: getParsed
/**
* Get things found by the $parser
* @see X_PageParser_Parser
* @return mixed
*/
public function getParsed(X_PageParser_Parser $parser = null)
{
if (!is_null($parser)) {
X_Debug::i("Temp pattern");
$loaded = $this->getLoader()->getPage($this->uri);
return $parser->parse($loaded);
} elseif ($this->parsed === null) {
$loaded = $this->getLoader()->getPage($this->uri);
$this->parsed = $this->getParser()->parse($loaded);
}
return $this->parsed;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:17,代码来源:Page.php
示例16: 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;
}
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:52,代码来源:AclResource.php
示例17: __construct
public function __construct(X_Vlc $vlcInstance = null)
{
if (is_null($vlcInstance)) {
$vlcInstance = X_Vlc::getLastInstance();
// OMG OMG no
}
if (is_null($vlcInstance)) {
// check again
X_Debug::e("Streamer engine VLC without a vlc instance available");
throw new Exception("No X_Vlc instance available");
}
$this->vlc = $vlcInstance;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:13,代码来源:Vlc.php
示例18: parse
public function parse($string)
{
$parsed = array();
if ($this->namespace) {
$parsed = simplexml_load_string($string, "SimpleXMLElement", 0, $this->namespace);
} else {
$parsed = simplexml_load_string($string);
}
if ($parsed === false) {
X_Debug::e("simplexml_load_string return error: invalid string");
$parsed = array();
}
return $parsed;
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:14,代码来源:SimpleXml.php
示例19: getResourceId
/**
* get the resource ID for the hoster
* from an $url
* @param string $url the hoster page
* @return string the resource id
*/
function getResourceId($url)
{
$matches = array();
if (preg_match(self::PATTERN, $url, $matches)) {
if ($matches['ID'] != '') {
return $matches['ID'];
}
X_Debug::e("No id found in {{$url}}", self::E_ID_NOTFOUND);
throw new Exception("No id found in {{$url}}");
} else {
X_Debug::e("Regex failed");
throw new Exception("Regex failed", self::E_URL_INVALID);
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:20,代码来源:GorillaVid.php
示例20: getIndexNews
/**
* Retrieve news from plugins
* @param Zend_Controller_Action $this
* @return X_Page_ItemList_News
*/
public function getIndexNews(Zend_Controller_Action $controller)
{
try {
$view = $controller->getHelper('viewRenderer');
$view->view->headScript()->appendFile('http://www.google.com/jsapi');
$view->view->headScript()->appendFile($view->view->baseUrl("/js/widgetdevnews/script.js"));
$view->view->headLink()->appendStylesheet($view->view->baseUrl('/css/widgetdevnews/style.css'));
$text = (include dirname(__FILE__) . '/WidgetDevNews.commits.phtml');
$item = new X_Page_Item_News($this->getId(), '');
$item->setTab(X_Env::_('p_widgetdevnews_commits_tab'))->setContent($text);
return new X_Page_ItemList_News(array($item));
} catch (Exception $e) {
X_Debug::e('No view O_o');
}
}
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:20,代码来源:WidgetDevNews.php
注:本文中的X_Debug类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论