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


PHP mb_orig_strpos函数代码示例

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


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

示例1: getBinaryStrpos

 /**
  *
  * Binary version of strpos
  * @param $haystack
  * @param $needle
  * @param int $offset
  * @return bool|int
  */
 public static function getBinaryStrpos($haystack, $needle, $offset = 0)
 {
     if (defined("BX_UTF")) {
         if (function_exists("mb_orig_strpos")) {
             return mb_orig_strpos($haystack, $needle, $offset);
         }
         return mb_strpos($haystack, $needle, $offset, "latin1");
     }
     return strpos($haystack, $needle, $offset);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:18,代码来源:string.php

示例2: find

 /**
  * Find class
  * @param string $class Class
  * @param string $namespace Namespace
  * @param string $rootns Root namespace
  * @return string
  */
 public static function find($class, $namespace = null, $rootns = null)
 {
     $e = explode('\\', $class);
     if ($e[0] === '') {
         return $class;
     }
     if ('Pool' === $class || 'TransportContext' === $class) {
         return '\\PHPDaemon\\Core\\' . $class;
     }
     if (mb_orig_strpos($class, '\\') === false && $namespace === null) {
         if ('Example' === substr($class, 0, 7)) {
             array_unshift($e, 'Examples');
         }
         if ('Server' === substr($class, -6)) {
             $path = '\\PHPDaemon\\Servers\\' . substr($class, 0, -6) . '\\Pool';
             $r = str_replace('\\Servers\\Servers', '\\Servers', $path);
             Daemon::log('ClassFinder: \'' . $class . '\' -> \'' . $r . '\', you should change your code.');
             return $r;
         }
         if ('Client' === substr($class, -6)) {
             $path = '\\PHPDaemon\\Clients\\' . substr($class, 0, -6) . '\\Pool';
             $r = str_replace('\\Clients\\Clients', '\\Clients', $path);
             Daemon::log('ClassFinder: \'' . $class . '\' -> \'' . $r . '\', you should change your code.');
             return $r;
         }
         if ('ClientAsync' === substr($class, -11)) {
             $path = '\\PHPDaemon\\Clients\\' . substr($class, 0, -11) . '\\Pool';
             $r = str_replace('\\Client\\Clients', '\\Clients', $path);
             Daemon::log('ClassFinder: \'' . $class . '\' -> \'' . $r . '\', you should change your code.');
             return $r;
         }
     }
     if ($namespace !== null && sizeof($e) < 2) {
         array_unshift($e, $namespace);
     }
     array_unshift($e, '\\' . ($rootns !== null ? $rootns : Daemon::$config->defaultns->value));
     return implode('\\', $e);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:45,代码来源:ClassFinder.php

示例3: onPacket

 /**
  * @param $p
  */
 protected function onPacket($p)
 {
     if ($p['op'] === 'spawnInstance') {
         $fullname = $p['appfullname'];
         $fullname = str_replace('-', ':', $fullname);
         if (mb_orig_strpos($fullname, ':') === false) {
             $fullname .= ':';
         }
         list($app, $name) = explode(':', $fullname, 2);
         Daemon::$appResolver->getInstance($app, $name, true, true);
     } elseif ($p['op'] === 'importFile') {
         if (!Daemon::$config->autoreimport->value) {
             Daemon::$process->gracefulRestart();
             return;
         }
         $path = $p['path'];
         Timer::add(function ($event) use($path) {
             if (Daemon::supported(Daemon::SUPPORT_RUNKIT_IMPORT)) {
                 //Daemon::log('--start runkit_import('.$path.')');
                 runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
                 //Daemon::log('--end runkit_import('.$path.')');
             } else {
                 $this->appInstance->log('Cannot import \'' . $path . '\': runkit_import is not callable.');
             }
             $event->finish();
         }, 5);
     } elseif ($p['op'] === 'call') {
         if (mb_orig_strpos($p['appfullname'], ':') === false) {
             $p['appfullname'] .= ':';
         }
         list($app, $name) = explode(':', $p['appfullname'], 2);
         if ($app = Daemon::$appResolver->getInstance($app, $name)) {
             $app->RPCall($p['method'], $p['args']);
         }
     }
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:39,代码来源:WorkerConnection.php

示例4: saslScrumSHA1Step

 public function saslScrumSHA1Step($session, $input = null)
 {
     $session['step']++;
     $query = [];
     if (!is_null($input) && (!empty($input['$err']) || !empty($input['errmsg']))) {
         $session['cb']($input);
         return;
     }
     if ($session['step'] == 1) {
         $session['nonce'] = base64_encode(openssl_random_pseudo_bytes(24));
         $payload = 'n,,n=' . $session['user'] . ',r=' . $session['nonce'];
         $query = ['saslStart' => 1, 'mechanism' => 'SCRAM-SHA-1', 'payload' => base64_encode($payload)];
         $session['auth_message'] .= 'n=' . $session['user'] . ',r=' . $session['nonce'] . ',';
     } elseif ($session['step'] == 2) {
         $in_payload = $this->saslScrumSHA1ExtractPayload($input['payload']);
         $error = null;
         if (count($in_payload) != 3) {
             $error = 'Incorrect number of arguments for first SCRAM-SHA-1 server message, got ' . count($in_payload) . 'expected 3';
         } elseif (mb_orig_strlen($in_payload['r']) < 2) {
             $error = 'Incorrect SCRAM-SHA-1 client|server nonce: ' . $in_payload['r'];
         } elseif (mb_orig_strlen($in_payload['s']) < 6) {
             $error = 'Incorrect SCRAM-SHA-1 salt: ' . $in_payload['s'];
         } elseif (mb_orig_strlen($in_payload['i']) < 3) {
             $error = 'Incorrect SCRAM-SHA-1 iteration count: ' . $in_payload['i'];
         } elseif (mb_orig_strpos($in_payload['r'], $session['nonce']) !== 0) {
             $error = 'Server SCRAM-SHA-1 nonce does not match client nonce';
         }
         if (!empty($error)) {
             $session['cb'](['ok' => 0, 'errmsg' => $error]);
             return;
         } else {
             $session['conversation_id'] = $input['conversationId'];
             $session['nonce'] = $in_payload['r'];
         }
         $payload = 'c=biws,r=' . $session['nonce'];
         $session['auth_message'] .= base64_decode($input['payload']) . ',' . $payload;
         $decoded_salt = base64_decode($in_payload['s']);
         $password = md5($session['user'] . ':mongo:' . $session['password']);
         $salted_password = hash_pbkdf2('sha1', $password, $decoded_salt, (int) $in_payload['i'], 0, true);
         $client_key = hash_hmac('sha1', 'Client Key', $salted_password, true);
         $stored_key = sha1($client_key, true);
         $client_sign = hash_hmac('sha1', $session['auth_message'], $stored_key, true);
         $client_proof = $client_key ^ $client_sign;
         $payload .= ',p=' . base64_encode($client_proof);
         $query = ['saslContinue' => 1, 'conversationId' => $session['conversation_id'], 'payload' => base64_encode($payload)];
     } elseif ($session['step'] == 3) {
         $in_payload = $this->saslScrumSHA1ExtractPayload($input['payload']);
         if (!empty($in_payload['v'])) {
             $session['server_signature'] = $in_payload['v'];
             $query = ['saslContinue' => 1, 'conversationId' => $session['conversation_id'], 'payload' => base64_encode('')];
         }
     } elseif ($session['step'] == 4) {
         $in_payload = $this->saslScrumSHA1ExtractPayload($input['payload']);
         $res = $input['done'] ? ['ok' => 1, 'server_signature' => $session['server_signature']] : ['ok' => 0, 'errmsg' => 'Authentication failed.'];
         $session['cb']($res);
         return;
     }
     $this->saslScrumSHA1Conversation($session['dbname'], $query, function ($res) use($session) {
         $this->saslScrumSHA1Step($session, $res);
     }, $session['conn']);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:61,代码来源:Pool.php

示例5: _getFilteredDirs

 private function _getFilteredDirs($dirs)
 {
     $curdir = getcwd();
     foreach ($dirs as $idx => $dir) {
         if ($dir === $curdir) {
             $dir = ".";
         }
         if (mb_orig_strpos($dir, "{$curdir}/") === 0) {
             $dir = mb_orig_substr($dir, mb_orig_strlen($curdir) + 1);
         }
         $parts = explode("/", $dir);
         foreach ($parts as $p) {
             if ($p === ".") {
                 continue;
             }
             if (isset($this->exclude[$p])) {
                 unset($dirs[$idx]);
                 continue 2;
             }
         }
         /* check if dir is still present, because event could be delivered when dir does not exist anymore */
         $stat = $this->_stat($dir);
         if ($stat !== 'dir') {
             unset($dirs[$idx]);
             continue;
         }
         $dirs[$idx] = $dir;
     }
     return $dirs;
 }
开发者ID:shiromart,项目名称:unrealsync,代码行数:30,代码来源:unrealsync.php

示例6: isUploadedFile

 /**
  * Tells whether the file was uploaded via HTTP POST
  * @param  string $path The filename being checked
  * @return boolean       Whether if this is uploaded file
  */
 public function isUploadedFile($path)
 {
     if (!$path) {
         return false;
     }
     if (mb_orig_strpos($path, $this->getUploadTempDir() . '/') !== 0) {
         return false;
     }
     foreach ($this->attrs->files as $file) {
         if ($file['tmp_name'] === $path) {
             return true;
         }
     }
     return false;
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:20,代码来源:Generic.php

示例7: _get_xml_chunk_mb_orig

 public function _get_xml_chunk_mb_orig($fp)
 {
     if ($this->buf_position >= $this->buf_len) {
         if (!feof($fp)) {
             $this->buf = fread($fp, $this->read_size);
             $this->buf_position = 0;
             $this->buf_len = mb_orig_strlen($this->buf);
         } else {
             return false;
         }
     }
     //Skip line delimiters (ltrim)
     $xml_position = mb_orig_strpos($this->buf, "<", $this->buf_position);
     while ($xml_position === $this->buf_position) {
         $this->buf_position++;
         $this->file_position++;
         //Buffer ended with white space so we can refill it
         if ($this->buf_position >= $this->buf_len) {
             if (!feof($fp)) {
                 $this->buf = fread($fp, $this->read_size);
                 $this->buf_position = 0;
                 $this->buf_len = mb_orig_strlen($this->buf);
             } else {
                 return false;
             }
         }
         $xml_position = mb_orig_strpos($this->buf, "<", $this->buf_position);
     }
     //Let's find next line delimiter
     while ($xml_position === false) {
         $next_search = $this->buf_len;
         //Delimiter not in buffer so try to add more data to it
         if (!feof($fp)) {
             $this->buf .= fread($fp, $this->read_size);
             $this->buf_len = mb_orig_strlen($this->buf);
         } else {
             break;
         }
         //Let's find xml tag start
         $xml_position = mb_orig_strpos($this->buf, "<", $next_search);
     }
     if ($xml_position === false) {
         $xml_position = $this->buf_len + 1;
     }
     $len = $xml_position - $this->buf_position;
     $this->file_position += $len;
     $result = mb_orig_substr($this->buf, $this->buf_position, $len);
     $this->buf_position = $xml_position;
     return $result;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:50,代码来源:cml2.php

示例8: initSettings

 /**
  * Loads default setting.
  * @return void
  */
 public static function initSettings()
 {
     Daemon::$version = file_get_contents('VERSION', true);
     Daemon::$config = new Config\Object();
     if (!defined('SO_REUSEPORT') && mb_orig_strpos(php_uname('s'), 'BSD') !== false) {
         // @TODO: better if-BSD check
         define('SO_REUSEPORT', 0x200);
     }
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:13,代码来源:Daemon.php

示例9: getRequest

 /**
  * Routes incoming request to related application
  * @param  object $req Generic
  * @param  object $upstream AppInstance of Upstream
  * @param  string $responder
  * @return object Request
  */
 public function getRequest($req, $upstream, $responder = null)
 {
     if (isset($req->attrs->server['APPNAME'])) {
         $appName = $req->attrs->server['APPNAME'];
     } elseif ($responder !== null) {
         $appName = $responder;
     } elseif (($appName = $this->getRequestRoute($req, $upstream)) !== null) {
         if ($appName === false) {
             return $req;
         }
     } else {
         return $req;
     }
     if (mb_orig_strpos($appName, ':') === false) {
         $appName .= ':';
     }
     list($app, $instance) = explode(':', $appName, 2);
     $appInstance = $this->getInstanceByAppName($app, $instance);
     if (!$appInstance) {
         return $req;
     }
     return $appInstance->handleRequest($req, $upstream);
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:30,代码来源:AppResolver.php

示例10: unserializePHP

 /**
  * session_decode() - clone, which not require session_start()
  * @see    http://www.php.net/manual/en/function.session-decode.php#108037
  * @param  string $session_data
  * @return array
  */
 protected function unserializePHP($session_data)
 {
     $return_data = array();
     $offset = 0;
     while ($offset < mb_orig_strlen($session_data)) {
         if (!strstr(substr($session_data, $offset), "|")) {
             return $return_data;
             //throw new \Exception("invalid session data, remaining: " . substr($session_data, $offset));
         }
         $pos = mb_orig_strpos($session_data, "|", $offset);
         $num = $pos - $offset;
         $varname = substr($session_data, $offset, $num);
         $offset += $num + 1;
         $data = unserialize(substr($session_data, $offset));
         $return_data[$varname] = $data;
         $offset += mb_orig_strlen(serialize($data));
     }
     return $return_data;
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:25,代码来源:Sessions.php

示例11: fastStrpos

 protected static function fastStrpos($haystack, $needle)
 {
     if (function_exists("mb_orig_strpos")) {
         return mb_orig_strpos($haystack, $needle);
     }
     return strpos($haystack, $needle);
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:7,代码来源:post_filter.php

示例12: parseCfgUri

 /**
  * Checks if property exists
  * @param string Property name
  * @return boolean Exists?
  */
 public static function parseCfgUri($uri, $source = null)
 {
     if (mb_orig_strpos($uri, '://') === false) {
         if (strncmp($uri, 'unix:', 5) === 0) {
             $e = explode(':', $uri);
             if (sizeof($e) === 4) {
                 $uri = 'unix://' . $e[1] . ':' . $e[2] . '@localhost' . $e[3];
             } elseif (sizeof($e) === 3) {
                 $uri = 'unix://' . $e[1] . '@localhost' . $e[2];
             } else {
                 $uri = 'unix://localhost' . $e[1];
             }
         } else {
             $uri = 'tcp://' . $uri;
         }
     }
     if (stripos($uri, 'unix:///') === 0) {
         $uri = 'unix://localhost/' . substr($uri, 8);
     }
     $zeroPortNum = false;
     $uri = preg_replace_callback('~:0(?:$|/)~', function () use(&$zeroPortNum) {
         $zeroPortNum = true;
         return '';
     }, $uri);
     $u = parse_url($uri);
     $u['host'] = trim($u['host'], '][');
     $u['uri'] = $uri;
     if ($zeroPortNum) {
         $u['port'] = 0;
     }
     if (!isset($u['scheme'])) {
         $u['scheme'] = '';
     }
     $u['params'] = [];
     if (!isset($u['fragment'])) {
         return $u;
     }
     $hash = '#' . $u['fragment'];
     $error = false;
     preg_replace_callback('~(#+)(.+?)(?=#|$)|(.+)~', function ($m) use(&$u, &$error, $uri) {
         if ($error) {
             return;
         }
         list(, $type, $value) = $m;
         if ($type === '#') {
             // standard value
             $e = explode('=', $value, 2);
             if (sizeof($e) === 2) {
                 list($key, $value) = $e;
             } else {
                 $key = $value;
                 $value = true;
             }
             $u['params'][$key] = $value;
         } elseif ($type === '##') {
             // Context name
             $u['params']['ctxname'] = $value;
         } else {
             Daemon::log('Malformed URI: ' . var_export($uri, true) . ', unexpected token \'' . $type . '\'');
             $error = true;
         }
     }, $hash);
     return $error ? false : $u;
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:69,代码来源:Object.php

示例13: addMode

 /**
  * @TODO DESCR
  * @param string $nick
  * @param string $mode
  */
 public function addMode($nick, $mode)
 {
     if (!isset($this->nicknames[$nick])) {
         return;
     }
     $participant = $this->nicknames[$nick];
     if (mb_orig_strpos($participant->mode, $mode) === false) {
         $participant->mode .= $mode;
     }
     $participant->onModeUpdate();
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:16,代码来源:Channel.php

示例14: strpos

 function strpos($a, $b)
 {
     return function_exists('mb_orig_strpos') ? mb_orig_strpos($a, $b) : strpos($a, $b);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:4,代码来源:include.php

示例15: _getChunk_mb_orig

 protected function _getChunk_mb_orig()
 {
     if ($this->_bufferPosition >= $this->_bufferLength) {
         if (!feof($this->_file)) {
             $this->_buffer = fread($this->_file, $this->_chunkReadSize);
             $this->_bufferPosition = 0;
             $this->_bufferLength = mb_orig_strlen($this->_buffer);
         } else {
             return false;
         }
     }
     //Skip line delimiters (ltrim)
     $position = mb_orig_strpos($this->_buffer, "<", $this->_bufferPosition);
     while ($position === $this->_bufferPosition) {
         $this->_bufferPosition++;
         $this->_filePosition++;
         //Buffer ended with white space so we can refill it
         if ($this->_bufferPosition >= $this->_bufferLength) {
             if (!feof($this->_file)) {
                 $this->_buffer = fread($this->_file, $this->_chunkReadSize);
                 $this->_bufferPosition = 0;
                 $this->_bufferLength = mb_orig_strlen($this->_buffer);
             } else {
                 return false;
             }
         }
         $position = mb_orig_strpos($this->_buffer, "<", $this->_bufferPosition);
     }
     //Let's find next line delimiter
     while ($position === false) {
         $next_search = $this->_bufferLength;
         //Delimiter not in buffer so try to add more data to it
         if (!feof($this->_file)) {
             $this->_buffer .= fread($this->_file, $this->_chunkReadSize);
             $this->_bufferLength = mb_orig_strlen($this->_buffer);
         } else {
             break;
         }
         //Let's find xml tag start
         $position = mb_orig_strpos($this->_buffer, "<", $next_search);
     }
     if ($position === false) {
         $position = $this->_bufferLength + 1;
     }
     $len = $position - $this->_bufferPosition;
     $this->_filePosition += $len;
     $result = mb_orig_substr($this->_buffer, $this->_bufferPosition, $len);
     $this->_bufferPosition = $position;
     return $result;
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:50,代码来源:parser.php


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