本文整理汇总了PHP中X_Debug::i方法的典型用法代码示例。如果您正苦于以下问题:PHP X_Debug::i方法的具体用法?PHP X_Debug::i怎么用?PHP X_Debug::i使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X_Debug
的用法示例。
在下文中一共展示了X_Debug::i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_afterPageBuild
public function gen_afterPageBuild(X_Page_ItemList_PItem $list, Zend_Controller_Action $controller)
{
if (!$this->isDefaultRenderer()) {
return;
}
X_Debug::i("Plugin triggered");
$request = $controller->getRequest();
$responseType = 'u:BrowseResponse';
$num = count($list->getItems());
if ($this->request['browseflag'] == 'BrowseMetadata') {
$parentID = $this->_getParent($controller->getRequest());
$item = new X_Page_Item_PItem('fake-item', "Container");
$item->setLink(array_merge(array('controller' => $controller->getRequest()->getControllerName(), 'action' => $controller->getRequest()->getActionName()), $controller->getRequest()->getParams()));
$item->setDescription("Fake description");
$didl = X_Upnp::createMetaDIDL($item, $parentID, $num, $controller->getRequest()->getControllerName(), $controller->getRequest()->getActionName(), $controller->getRequest()->getParam('p', 'null'));
} elseif ($this->request['browseflag'] == 'BrowseDirectChildren') {
$parentID = $this->request['objectid'];
$didl = X_Upnp::createDIDL($list->getItems(), $parentID, $num, $controller->getRequest()->getControllerName(), $controller->getRequest()->getActionName(), $controller->getRequest()->getParam('p', 'null'));
}
$xmlDIDL = $didl->saveXML();
X_Debug::i("DIDL response: {$xmlDIDL}");
// Build SOAP-XML reply from DIDL-XML and send it to upnp device
$domSOAP = X_Upnp::createSOAPEnvelope($xmlDIDL, $num, $num, $responseType, $parentID);
$soapXML = $domSOAP->saveXML();
// turn off viewRenderer and Layout, add Content-Type and set response body
$this->_render($soapXML, $controller);
}
示例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'));
}
}
示例3: 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');
}
示例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;
}
示例5: 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));
}
示例6: 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");
}
}
示例7: saveAction
public function saveAction()
{
/* @var $request Zend_Controller_Request_Http */
$request = $this->getRequest();
$configs = Application_Model_ConfigsMapper::i()->fetchAll();
if ($request->isPost()) {
$form = $this->_initConfigsForm($configs, $request->getPost());
if (!$form->isErrors()) {
$post = $request->getPost();
$isError = false;
foreach ($configs as $config) {
/* @var $config Application_Model_Config */
if ($config->getSection() == 'plugins') {
continue;
}
// plugins config will not be handled here
$postStoreName = $config->getSection() . "_" . str_replace('.', '_', $config->getKey());
// ISSUE-15: https://code.google.com/p/vlc-shares/issues/detail?id=15
// This is a workaround it: remove slashes if magic_quotes is enabled
// FIXME remove this workaround in vlc-shares 0.6+
$postValue = $request->getPost($postStoreName);
if (get_magic_quotes_gpc()) {
//$postValue = str_replace(array('\\\\' , '=\\"'), array('\\', '="'), $postValue );
$postValue = stripslashes($postValue);
}
if (array_key_exists($postStoreName, $post) && $config->getValue() != $postValue) {
// new value
try {
$config->setValue($postValue);
Application_Model_ConfigsMapper::i()->save($config);
if (stripos($config->getKey(), 'password') != false) {
X_Debug::i("New config: {$config->getSection()}.{$config->getKey()} = ***********");
} else {
X_Debug::i("New config: {$config->getSection()}.{$config->getKey()} = {$config->getValue()}");
}
} catch (Exception $e) {
$isError = true;
$this->_helper->flashMessenger(X_Env::_('configs_save_err_db') . ": {$e->getMessage()}");
}
}
}
if (!$isError) {
$this->_helper->flashMessenger(X_Env::_('configs_save_done'));
}
if ($form->getValue('isapply') == '1') {
$this->_helper->redirector('index', 'configs');
} else {
$this->_helper->redirector('index', 'manage');
}
} else {
$this->_forward('index');
}
} else {
$this->_helper->flashMessenger(X_Env::_('configs_save_nodata'));
$this->_helper->redirector('index', 'configs');
}
}
示例8: 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()
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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();
}
示例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);
}
}
}
示例13: 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');
}
}
示例14: 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;
}
示例15: 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;
}
}
}