当前位置: 首页>>代码示例>>PHP>>正文


PHP X_Debug类代码示例

本文整理汇总了PHP中X_Debug的典型用法代码示例。如果您正苦于以下问题:PHP X_Debug类的具体用法?PHP X_Debug怎么用?PHP X_Debug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了X_Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的X_Debug类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。