當前位置: 首頁>>代碼示例>>PHP>>正文


PHP elFinder::base64encodeSessionData方法代碼示例

本文整理匯總了PHP中elFinder::base64encodeSessionData方法的典型用法代碼示例。如果您正苦於以下問題:PHP elFinder::base64encodeSessionData方法的具體用法?PHP elFinder::base64encodeSessionData怎麽用?PHP elFinder::base64encodeSessionData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在elFinder的用法示例。


在下文中一共展示了elFinder::base64encodeSessionData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param  array  elFinder and roots configurations
  * @return void
  * @author Dmitry (dio) Levashov
  **/
 public function __construct($opts)
 {
     if (session_id() == '') {
         session_start();
     }
     $sessionUseCmds = array('netmount', 'netunmount');
     if (isset($opts['sessionUseCmds']) && is_array($opts['sessionUseCmds'])) {
         $sessionUseCmds = array_merge($sessionUseCmds, $opts['sessionUseCmds']);
     }
     // set self::$volumesCnt by HTTP header "X-elFinder-VolumesCntStart"
     if (isset($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']) && ($volumesCntStart = intval($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']))) {
         self::$volumesCnt = $volumesCntStart;
     }
     $this->time = $this->utime();
     $this->debug = isset($opts['debug']) && $opts['debug'] ? true : false;
     $this->sessionCloseEarlier = isset($opts['sessionCloseEarlier']) ? (bool) $opts['sessionCloseEarlier'] : true;
     $this->sessionUseCmds = array_flip($sessionUseCmds);
     $this->timeout = isset($opts['timeout']) ? $opts['timeout'] : 0;
     $this->uploadTempPath = isset($opts['uploadTempPath']) ? $opts['uploadTempPath'] : '';
     $this->netVolumesSessionKey = !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes';
     $this->callbackWindowURL = isset($opts['callbackWindowURL']) ? $opts['callbackWindowURL'] : '';
     self::$sessionCacheKey = !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches';
     // check session cache
     $_optsMD5 = md5(json_encode($opts['roots']));
     if (!isset($_SESSION[self::$sessionCacheKey]) || $_SESSION[self::$sessionCacheKey]['_optsMD5'] !== $_optsMD5) {
         $_SESSION[self::$sessionCacheKey] = array('_optsMD5' => $_optsMD5);
     }
     self::$base64encodeSessionData = !empty($opts['base64encodeSessionData']);
     // setlocale and global locale regists to elFinder::locale
     self::$locale = !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8';
     if (false === @setlocale(LC_ALL, self::$locale)) {
         self::$locale = setlocale(LC_ALL, '');
     }
     // bind events listeners
     if (!empty($opts['bind']) && is_array($opts['bind'])) {
         $_req = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
         $_reqCmd = isset($_req['cmd']) ? $_req['cmd'] : '';
         foreach ($opts['bind'] as $cmd => $handlers) {
             $doRegist = strpos($cmd, '*') !== false;
             if (!$doRegist) {
                 $_getcmd = create_function('$cmd', 'list($ret) = explode(\'.\', $cmd);return trim($ret);');
                 $doRegist = $_reqCmd && in_array($_reqCmd, array_map($_getcmd, explode(' ', $cmd)));
             }
             if ($doRegist) {
                 if (!is_array($handlers) || is_object($handlers[0])) {
                     $handlers = array($handlers);
                 }
                 foreach ($handlers as $handler) {
                     if ($handler) {
                         if (is_string($handler) && strpos($handler, '.')) {
                             list($_domain, $_name, $_method) = array_pad(explode('.', $handler), 3, '');
                             if (strcasecmp($_domain, 'plugin') === 0) {
                                 if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name]) ? $opts['plugin'][$_name] : array()) and method_exists($plugin, $_method)) {
                                     $this->bind($cmd, array($plugin, $_method));
                                 }
                             }
                         } else {
                             $this->bind($cmd, $handler);
                         }
                     }
                 }
             }
         }
     }
     if (!isset($opts['roots']) || !is_array($opts['roots'])) {
         $opts['roots'] = array();
     }
     // check for net volumes stored in session
     foreach ($this->getNetVolumes() as $key => $root) {
         $opts['roots'][$key] = $root;
     }
     // "mount" volumes
     foreach ($opts['roots'] as $i => $o) {
         $class = 'elFinderVolume' . (isset($o['driver']) ? $o['driver'] : '');
         if (class_exists($class)) {
             $volume = new $class();
             try {
                 if ($volume->mount($o)) {
                     // unique volume id (ends on "_") - used as prefix to files hash
                     $id = $volume->id();
                     $this->volumes[$id] = $volume;
                     if (!$this->default && $volume->isReadable()) {
                         $this->default = $this->volumes[$id];
                     }
                 } else {
                     $this->removeNetVolume($i);
                     $this->mountErrors[] = 'Driver "' . $class . '" : ' . implode(' ', $volume->error());
                 }
             } catch (Exception $e) {
                 $this->removeNetVolume($i);
                 $this->mountErrors[] = 'Driver "' . $class . '" : ' . $e->getMessage();
             }
         } else {
//.........這裏部分代碼省略.........
開發者ID:oblagiolabs,項目名稱:core,代碼行數:101,代碼來源:elFinder.class.php


注:本文中的elFinder::base64encodeSessionData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。