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


PHP X_Env类代码示例

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


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

示例1: proxyAction

 function proxyAction()
 {
     // time to get params from get
     /* @var $request Zend_Controller_Request_Http */
     $request = $this->getRequest();
     if (!$this->plugin->config('proxy.enabled', true) && !X_VlcShares_Plugins::helpers()->devices()->isWiimc()) {
         throw new Exception(X_Env::_('p_animeftw_err_proxydisabled'));
     }
     // this action is so special.... no layout or viewRenderer
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $videoUrl = $request->getParam('v', false);
     // video file url
     $refererUrl = $request->getParam('r', false);
     // referer page needed
     if ($videoUrl === false || $refererUrl === false) {
         // invalid request
         throw new Exception(X_Env::_('p_animeftw_err_invalidrequest'));
         return;
     }
     $videoUrl = X_Env::decode($videoUrl);
     $refererUrl = X_Env::decode($refererUrl);
     // if user abort request (vlc/wii stop playing, this process ends
     ignore_user_abort(false);
     // close and clean the output buffer, everything will be read and send to device
     ob_end_clean();
     //$userAgent = $this->plugin->config('hide.useragent', true) ? 'User-Agent: vlc-shares/'.X_VlcShares::VERSION : 'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20101019 Firefox/4.0.1';
     $userAgent = 'User-Agent: vlc-shares/' . X_VlcShares::VERSION . ' animeftw/' . X_VlcShares_Plugins_AnimeFTW::VERSION;
     $opts = array('http' => array('header' => array("Referer: {$refererUrl}", "User-Agent: {$userAgent}")));
     $context = stream_context_create($opts);
     // readfile open a file and send it directly to output buffer
     readfile($videoUrl, false, $context);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:33,代码来源:AnimeftwController.php

示例2: startEngine

 public function startEngine(X_Threads_Thread $thread)
 {
     // assume all parameters are ready
     $thread->log("Spawning RTMPDump (rtmpdump-weebtv | vlc)...");
     $source = $this->getParam('source');
     // set the path
     if (X_Env::isWindows()) {
         X_RtmpDumpWeebTv::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-weebtv-win/rtmpdump-weebtv.exe');
     } else {
         X_RtmpDumpWeebTv::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-weebtv-linux/rtmpdump-weebtv');
     }
     $weebPlugin = X_VlcShares_Plugins::broker()->getPlugins('weebtv');
     if ($weebPlugin instanceof X_VlcShares_Plugins_WeebTv && X_VlcShares_Plugins::helpers()->streamer()->isRegistered('vlc')) {
         // try to get reference to vlc-streamer
         /* @var $vlcStreamer X_Streamer_Engine_Vlc */
         $vlcStreamer = X_VlcShares_Plugins::helpers()->streamer()->get('vlc');
         // get the channel id
         $source = substr($source, strlen('rtmpdump-weebtv://'));
         // make the plugin to parse params from server and build a rtmpdump-weebtv uri
         $source = $weebPlugin->getLinkParams($source);
         // always live
         $command = (string) X_RtmpDumpWeebTv::getInstance()->parseUri($source);
         $vlcStreamer->getVlcWrapper()->setPipe($command);
         $vlcStreamer->setSource('-');
         $vlcStreamer->setParam('profile', "#std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:{$weebPlugin->getStreamingPort()}/stream}");
         // redirect std error to null
         // and force quite
         //X_Env::execute("$command -q 2> /dev/null", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
         //X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
         $vlcStreamer->getVlcWrapper()->spawn();
         $thread->log("RTMPDump execution finished");
     } else {
         $thread->log("RTMPDump-weebtv cannot be started without weebtv plugin and vlc streamer");
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:35,代码来源:RtmpDumpWeebTv.php

示例3: addAction

 public function addAction()
 {
     $request = $this->getRequest();
     $form = new Application_Form_Bookmark();
     $form->setAction($this->_helper->url('add'));
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             $bookmark = new Application_Model_Bookmark();
             $id = $request->getParam('id', false);
             if ($id !== false && !is_null($id)) {
                 Application_Model_BookmarksMapper::i()->find($id, $bookmark);
                 if ($bookmark->isNew() || $bookmark->getId() != $id) {
                     throw new Exception(X_Env::_('p_bookmarks_err_invalidid'));
                 }
             }
             $url = $form->getValue('url');
             $title = $form->getValue('title');
             $description = $form->getValue('description');
             $thumbnail = $form->getValue('thumbnail');
             $bookmark->setUrl($url);
             $bookmark->setTitle($title);
             $bookmark->setThumbnail($thumbnail);
             $bookmark->setDescription($description);
             Application_Model_BookmarksMapper::i()->save($bookmark);
             //return $this->_helper->redirector('index');
             $this->_helper->redirector('index', 'bookmarks');
         }
     }
     $this->view->form = $form;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:30,代码来源:BookmarksController.php

示例4: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->addElement('select', 'hoster', array('label' => X_Env::_('p_onlinelibrary_form_hoster_name'), 'description' => X_Env::_('p_onlinelibrary_form_hoster_description'), 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'idVideo', array('label' => X_Env::_('p_onlinelibrary_form_idvideo_name'), 'description' => X_Env::_('p_onlinelibrary_form_idvideo_description'), 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'category', array('label' => X_Env::_('p_onlinelibrary_form_category_name'), 'description' => X_Env::_('p_onlinelibrary_form_category_description'), 'required' => true, 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 50)))));
     $this->addElement('checkbox', 'check', array('label' => X_Env::_('p_onlinelibrary_form_check_name'), 'description' => X_Env::_('p_onlinelibrary_form_check_description'), 'required' => false));
     // Add the comment element
     $this->addElement('text', 'title', array('label' => X_Env::_('p_onlinelibrary_form_title_name'), 'description' => X_Env::_('p_onlinelibrary_form_title_description'), 'required' => false, 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 50)))));
     $this->addElement('textarea', 'description', array('label' => X_Env::_('p_onlinelibrary_form_description_name'), 'description' => X_Env::_('p_onlinelibrary_form_description_description'), 'rows' => '5', 'filters' => array('StripTags'), 'required' => false));
     // Add the comment element
     $this->addElement('text', 'thumbnail', array('label' => X_Env::_('p_onlinelibrary_form_thumbnail_name'), 'description' => X_Env::_('p_onlinelibrary_form_thumbnail_description'), 'required' => false));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_submit')));
     // Add the submit button
     $this->addElement('button', 'abort', array('onClick' => 'javascript:history.back();', 'ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_abort')));
     $this->addDisplayGroup(array('submit', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators()));
     /*
     // And finally add some CSRF protection
     $this->addElement('hash', 'csrf', array(
         'ignore' => true,
     ));
     */
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:25,代码来源:Video.php

示例5: 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;
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:30,代码来源:Vlc.php

示例6: forceKill

 public function forceKill()
 {
     if (!X_Env::isWindows()) {
         X_Env::execute("kill -9 `ps aux | grep {$this->path} | grep -v grep | awk '{print \$2}'`", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
     } else {
         X_Env::execute("taskkill /IM SopCast.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:8,代码来源:SopCast.php

示例7: 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

示例8: init

 public function init()
 {
     parent::init();
     if (!X_VlcShares_Plugins::broker()->isRegistered('upnprenderer')) {
         throw new Exception(X_Env::_('err_pluginnotregistered') . ": upnprenderer");
     } else {
         $this->plugin = X_VlcShares_Plugins::broker()->getPlugins('upnprenderer');
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:9,代码来源:UpnpController.php

示例9: startEngine

 public function startEngine(X_Threads_Thread $thread)
 {
     // assume all parameters are ready
     $thread->log("Spawning SopCast...");
     $source = $this->getParam('source');
     $command = (string) X_SopCast::getInstance()->setUri($source);
     X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
     //$this->vlc->spawn();
     $thread->log("SopCast execution finished");
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:10,代码来源:SopCast.php

示例10: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $this->addElement('hidden', 'key', array('ignore' => false, 'decorators' => array('ViewHelper'), 'required' => true));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('plugin_action_uninstall'), 'decorators' => array('ViewHelper')));
     // And finally add some CSRF protection
     $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'plugin_uconfirm_salt', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'csrf', 'key'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators()));
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:11,代码来源:PluginUConfirm.php

示例11: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $this->addElement('file', 'file', array('label' => X_Env::_('plugin_install_label'), 'description' => X_Env::_('plugin_install_desc'), 'required' => true, 'filters' => array('StringTrim'), 'destination' => APPLICATION_PATH . '/../data/plugin/', 'validators' => array(array('validator' => 'Count', 'options' => array(false, 1)), array('validator' => 'Size', 'options' => array(false, ini_get('upload_max_filesize'))), array('validator' => 'Extension', 'options' => array(false, 'zip,xegg'))), 'decorators' => array('CompositeFile')));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('plugin_installsubmit')));
     // And finally add some CSRF protection
     $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'plugin_install_salt'));
     $this->addDisplayGroup(array('submit', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators()));
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:11,代码来源:PluginInstall.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: _checkEntry

 /**
  * 
  * @param DirectoryIterator $entry
  */
 private function _checkEntry($entry)
 {
     if (X_Env::isWindows()) {
         return !$this->_isHiddenOnWindows($entry);
     } else {
         // in linux, hidden files start with .
         if (substr(pathinfo($entry, PATHINFO_BASENAME), 0, 1) == '.') {
             return false;
         }
     }
     return true;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:16,代码来源:HideHidden.php

示例14: preGetControlItems

 /**
  * Add the button BackToStream in controls page
  *
  * @param X_Streamer_Engine $engine
  * @param Zend_Controller_Action $controller the controller who handle the request
  * @return array
  */
 public function preGetControlItems(X_Streamer_Engine $engine, Zend_Controller_Action $controller)
 {
     // ignore if the streamer is not vlc
     if (!$engine instanceof X_Streamer_Engine_RtmpDump) {
         return;
     }
     $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_profiles_backstream'));
     $item->setType(X_Page_Item_PItem::TYPE_PLAYABLE)->setIcon('/images/icons/play.png')->setLink($outputLink);
     return new X_Page_ItemList_PItem(array($item));
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:19,代码来源:RtmpDump.php

示例15: scriptAction

 public function scriptAction()
 {
     $hosters = X_VlcShares_Plugins::helpers()->hoster()->getHosters();
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $csrf->initCsrfToken();
     $this->view->hosters = $hosters;
     $this->view->frameUrl = X_Env::completeUrl($this->_helper->url->url(array('controller' => 'bookmarklets', 'action' => 'frame')));
     $this->view->cssUrl = X_Env::completeUrl($this->_helper->viewRenderer->view->baseUrl('/css/bookmarklets/injected.css'));
     $this->view->xfcUrl = X_Env::completeUrl($this->_helper->viewRenderer->view->baseUrl('/js/jquery.xfc.js'));
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setViewSuffix('pjs');
     $this->getResponse()->setHeader('Content-Type', 'application/javascript');
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:13,代码来源:BookmarkletsController.php


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