本文整理汇总了PHP中strncasecmp函数的典型用法代码示例。如果您正苦于以下问题:PHP strncasecmp函数的具体用法?PHP strncasecmp怎么用?PHP strncasecmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strncasecmp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _getTextMode
private static function _getTextMode()
{
if (!function_exists('getText') || strncasecmp(PHP_OS, 'WIN', 3) == 0) {
return self::GETTEXT_MODE_LIBRARY;
}
return self::GETTEXT_MODE_NATIVE;
}
开发者ID:erichub,项目名称:Presence-V-0.1,代码行数:7,代码来源:Lang.class.php
示例2: constructUrl
/**
* Constructs absolute URL from Request object.
* @return string|NULL
*/
public function constructUrl(PresenterRequest $appRequest, Url $refUrl)
{
if ($this->flags & self::ONE_WAY) {
return NULL;
}
$params = $appRequest->getParameters();
// presenter name
$presenter = $appRequest->getPresenterName();
if (strncasecmp($presenter, $this->module, strlen($this->module)) === 0) {
$params[self::PRESENTER_KEY] = substr($presenter, strlen($this->module));
} else {
return NULL;
}
// remove default values; NULL values are retain
foreach ($this->defaults as $key => $value) {
if (isset($params[$key]) && $params[$key] == $value) {
// intentionally ==
unset($params[$key]);
}
}
$url = ($this->flags & self::SECURED ? 'https://' : 'http://') . $refUrl->getAuthority() . $refUrl->getPath();
$sep = ini_get('arg_separator.input');
$query = http_build_query($params, '', $sep ? $sep[0] : '&');
if ($query != '') {
// intentionally ==
$url .= '?' . $query;
}
return $url;
}
开发者ID:riskatlas,项目名称:micka,代码行数:33,代码来源:SimpleRouter.php
示例3: matches
/**
* Match a list of proxies.
*
* @param array $list The list of proxies in front of this service.
*
* @return bool
*/
public function matches(array $list)
{
$list = array_values($list);
// Ensure that we have an indexed array
if ($this->isSizeValid($list)) {
$mismatch = false;
foreach ($this->chain as $i => $search) {
$proxy_url = $list[$i];
if (preg_match('/^\\/.*\\/[ixASUXu]*$/s', $search)) {
if (preg_match($search, $proxy_url)) {
phpCAS::trace("Found regexp " . $search . " matching " . $proxy_url);
} else {
phpCAS::trace("No regexp match " . $search . " != " . $proxy_url);
$mismatch = true;
break;
}
} else {
if (strncasecmp($search, $proxy_url, strlen($search)) == 0) {
phpCAS::trace("Found string " . $search . " matching " . $proxy_url);
} else {
phpCAS::trace("No match " . $search . " != " . $proxy_url);
$mismatch = true;
break;
}
}
}
if (!$mismatch) {
phpCAS::trace("Proxy chain matches");
return true;
}
} else {
phpCAS::trace("Proxy chain skipped: size mismatch");
}
return false;
}
开发者ID:dungvu,项目名称:tcexam,代码行数:42,代码来源:ProxyChain.php
示例4: run
public static function run()
{
if (!Site::init(!empty($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : '')) {
@header('HTTP/1.1 404 Not Found');
exit;
}
$method = Core::getRequestMethod();
if (!in_array($method, array('get', 'put', 'delete', 'post'))) {
@header("HTTP/1.1 501 Not Implemented");
exit;
}
$data = Core::getRequestData();
if (empty($data[$method]) && !in_array($_SERVER['REQUEST_URI'], array($_SERVER['SCRIPT_NAME'], "", "/"))) {
$data[$method] = $_SERVER['REQUEST_URI'];
}
$resource = Core::getResource($data, $method);
$staticFolders = array('/cache/', '/static/', '/uploads/', '/vendor/');
foreach ($staticFolders as $folder) {
if (strncasecmp($resource, $folder, strlen($folder)) === 0) {
@header('HTTP/1.1 404 Not Found');
exit;
}
}
App::set(App::parse($resource));
Core::resource($resource);
Module::init();
$response = Response\Factory::get($resource, $method);
if (empty($response)) {
@header('HTTP/1.1 406 Not Acceptable');
exit;
}
Request::init($response, $data);
echo Request::run($resource, $method);
}
开发者ID:pinahq,项目名称:framework,代码行数:34,代码来源:App.php
示例5: copyFile
/**
* Copy file.
*
* @param string $source source file path
* @param string $dest destination file path.
* @param bool|null $overwrite whether to overwrite destination file if it already exist.
* @return bool whether the copying operation succeeded.
*/
public static function copyFile($source, $dest, $overwrite = null)
{
if (!is_file($source)) {
Console::stderr("File {$dest} skipped ({$source} not exist)", Console::FG_GREEN);
return true;
}
if (is_file($dest)) {
if (file_get_contents($source) === file_get_contents($dest)) {
Console::stdout("File {$dest} unchanged", Console::FG_GREEN);
return true;
}
Console::stdout("File {$dest} exist, overwrite? [Yes|No|Quit]", Console::FG_YELLOW);
$answer = $overwrite === null ? Console::stdin() : $overwrite;
if (!strncasecmp($answer, 'q', 1) || strncasecmp($answer, 'y', 1) !== 0) {
Console::stdout("Skipped {$dest}", Console::FG_GREEN);
return false;
}
file_put_contents($dest, file_get_contents($source));
Console::stdout("Overwritten {$dest}", Console::FG_GREEN);
return true;
}
if (!is_dir(dirname($dest))) {
@mkdir(dirname($dest), 0777, true);
}
file_put_contents($dest, file_get_contents($source));
Console::stdout("Copied {$source} to {$dest}", Console::FG_GREEN);
return true;
}
开发者ID:delagics,项目名称:yii2-app-another,代码行数:36,代码来源:Initializer.php
示例6: substr_compare
function substr_compare($main_str, $str, $offset, $length = NULL, $case_insensitivity = false)
{
$offset = (int) $offset;
// Throw a warning because the offset is invalid
if ($offset >= strlen($main_str)) {
trigger_error('The start position cannot exceed initial string length.', E_USER_WARNING);
return false;
}
// We are comparing the first n-characters of each string, so let's use the PHP function to do it
if ($offset == 0 && is_int($length) && $case_insensitivity === true) {
return strncasecmp($main_str, $str, $length);
}
// Get the substring that we are comparing
if (is_int($length)) {
$main_substr = substr($main_str, $offset, $length);
$str_substr = substr($str, 0, $length);
} else {
$main_substr = substr($main_str, $offset);
$str_substr = $str;
}
// Return a case-insensitive comparison of the two strings
if ($case_insensitivity === true) {
return strcasecmp($main_substr, $str_substr);
}
// Return a case-sensitive comparison of the two strings
return strcmp($main_substr, $str_substr);
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:27,代码来源:base.php
示例7: proc
/**
* @brief Widget execution
* Get extra_vars declared in ./widgets/widget/conf/info.xml as arguments
* After generating the result, do not print but return it.
*/
function proc($args)
{
// Set a path of the template skin (values of skin, colorset settings)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// Specify a template file
if (Context::get('is_logged')) {
$tpl_file = 'login_info';
} else {
$tpl_file = 'login_form';
}
// Get the member configuration
$oModuleModel = getModel('module');
$this->member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $this->member_config);
// Set a flag to check if the https connection is made when using SSL and create https url
$ssl_mode = false;
$useSsl = Context::getSslStatus();
if ($useSsl != 'none') {
if (strncasecmp('https://', Context::getRequestUri(), 8) === 0) {
$ssl_mode = true;
}
}
Context::set('ssl_mode', $ssl_mode);
// Compile a template
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
开发者ID:kimkucheol,项目名称:xe-core,代码行数:33,代码来源:login_info.class.php
示例8: __construct
/**
* Constructor
*
* @param string|RFormatter $format Output format ID, or formatter instance defaults to 'html'
*/
public function __construct($format = 'html')
{
static $didIni = false;
if (!$didIni) {
$didIni = true;
foreach (array_keys(static::$config) as $key) {
$iniVal = get_cfg_var('ref.' . $key);
print_r($iniVal);
if ($iniVal !== false) {
static::$config[$key] = $iniVal;
}
}
}
if ($format instanceof RFormatter) {
$this->fmt = $format;
} else {
$format = __NAMESPACE__ . '\\' . (isset(static::$config['formatters'][$format]) ? static::$config['formatters'][$format] : 'R' . ucfirst($format) . 'Formatter');
if (!class_exists($format, true)) {
throw new \Exception(sprintf('%s class not found', $format));
}
$this->fmt = new $format();
}
if (static::$env) {
return;
}
static::$env = array('is54' => version_compare(PHP_VERSION, '5.4') >= 0, 'is546' => version_compare(PHP_VERSION, '5.4.6') >= 0, 'is56' => version_compare(PHP_VERSION, '5.6') >= 0, 'curlActive' => function_exists('curl_version'), 'mbStr' => function_exists('mb_detect_encoding'), 'supportsDate' => strncasecmp(PHP_OS, 'WIN', 3) !== 0 || version_compare(PHP_VERSION, '5.3.10') >= 0);
}
开发者ID:kardagan,项目名称:PhpDevTools,代码行数:32,代码来源:ref.php
示例9: findColumns
/**
* Collects the table column metadata.
* @param CDbTableSchema the table metadata
* @return boolean whether the table exists in the database
*/
protected function findColumns($table)
{
$sql = "PRAGMA table_info({$table->rawName})";
$columns = $this->getDbConnection()->createCommand($sql)->queryAll();
if (empty($columns)) {
return false;
}
foreach ($columns as $column) {
$c = $this->createColumn($column);
$table->columns[$c->name] = $c;
if ($c->isPrimaryKey) {
if ($table->primaryKey === null) {
$table->primaryKey = $c->name;
} else {
if (is_string($table->primaryKey)) {
$table->primaryKey = array($table->primaryKey, $c->name);
} else {
$table->primaryKey[] = $c->name;
}
}
}
}
if (is_string($table->primaryKey) && !strncasecmp($table->columns[$table->primaryKey]->dbType, 'int', 3)) {
$table->sequenceName = '';
}
return true;
}
开发者ID:Greka163,项目名称:Yii-blog-new,代码行数:32,代码来源:CSqliteSchema.php
示例10: getBlockCode_ViewImage
function getBlockCode_ViewImage()
{
$sSiteUrl = $this->_aSite['url'];
$aFile = BxDolService::call('photos', 'get_photo_array', array($this->_aSite['photo'], 'file'), 'Search');
$sImage = $aFile['no_image'] ? '' : $aFile['file'];
// BEGIN STW INTEGRATION
if (getParam('bx_sites_account_type') != 'No Automated Screenshots') {
if ($sImage == '') {
$aSTWOptions = array();
bx_sites_import('STW');
$sThumbHTML = getThumbnailHTML($sSiteUrl, $aSTWOptions, false, false);
}
}
// END STW INTEGRATION
$sVote = '';
if (strncasecmp($sSiteUrl, 'http://', 7) != 0 && strncasecmp($sSiteUrl, 'https://', 8) != 0) {
$sSiteUrl = 'http://' . $sSiteUrl;
}
if ($this->_oConfig->isVotesAllowed() && $this->_oSites->oPrivacy->check('rate', $this->_aSite['id'], $this->_oSites->iOwnerId)) {
bx_import('BxTemplVotingView');
$oVotingView = new BxTemplVotingView('bx_sites', $this->_aSite['id']);
if ($oVotingView->isEnabled()) {
$sVote = $oVotingView->getBigVoting();
}
}
$sContent = $this->_oTemplate->parseHtmlByName('view_image.html', array('title' => $this->_aSite['title'], 'site_url' => $sSiteUrl, 'site_url_view' => $this->_aSite['url'], 'bx_if:is_image' => array('condition' => $sThumbHTML == false, 'content' => array('image' => $sImage ? $sImage : $this->_oTemplate->getImageUrl('no-image-thumb.png'))), 'bx_if:is_thumbhtml' => array('condition' => $sThumbHTML != '', 'content' => array('thumbhtml' => $sThumbHTML)), 'vote' => $sVote, 'view_count' => $this->_aSite['views']));
return array($sContent, array(), array(), false);
}
开发者ID:Arvindvi,项目名称:dolphin,代码行数:28,代码来源:BxSitesPageView.php
示例11: actionIndex
/**
* Index
*/
public function actionIndex()
{
// define confirm message
$confirmMsg = "\r\n";
$confirmMsg .= "Please confirm:\r\n";
$confirmMsg .= "\r\n";
$confirmMsg .= " From [ {$this->from} ]\r\n";
$confirmMsg .= " To [ {$this->to} ]\r\n";
$confirmMsg .= " Namespace [ {$this->namespace} ]\r\n";
$confirmMsg .= "\r\n";
$confirmMsg .= "(yes|no)";
// confirm copy
$confirm = $this->prompt($confirmMsg, ["required" => true, "default" => "no"]);
// process copy
if (strncasecmp($confirm, "y", 1) === 0) {
// handle aliases and copy files
$fromPath = Yii::getAlias($this->from);
$toPath = Yii::getAlias($this->to);
$this->copyFiles($fromPath, $toPath, $this->namespace);
} else {
echo "\r\n";
echo "--- Copy cancelled! --- \r\n";
echo "\r\n";
echo "You can specify the paths using:\r\n\r\n";
echo " php yii user/copy --from=@vendor/amnah/yii2-user";
echo " --to=@app/modules/user --namespace=app\\\\modules\\\\user";
echo "\r\n";
}
}
开发者ID:anawatom,项目名称:second,代码行数:32,代码来源:CopyController.php
示例12: statement
protected function statement($key, $value)
{
if (strncasecmp($key, 'etag', 4) == 0) {
$value = '"' . $value . '"';
}
return sprintf('%s: %s', $key, (string) $value);
}
开发者ID:ephigenia,项目名称:ephframe,代码行数:7,代码来源:Header.php
示例13: handle
public function handle(Event $event)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) {
return false;
}
$exception = $event->getParameter('exception');
$request = $event->getParameter('request');
if (null !== $this->logger) {
$this->logger->err(sprintf('%s: %s (uncaught exception)', get_class($exception), $exception->getMessage()));
} else {
error_log(sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()));
}
$logger = null !== $this->logger ? $this->logger->getDebugLogger() : null;
$attributes = array('_controller' => $this->controller, 'exception' => FlattenException::create($exception), 'logger' => $logger, 'format' => 0 === strncasecmp(PHP_SAPI, 'cli', 3) ? 'txt' : $request->getRequestFormat());
$request = $request->duplicate(null, null, $attributes);
try {
$response = $event->getSubject()->handle($request, HttpKernelInterface::SUB_REQUEST, true);
} catch (\Exception $e) {
if (null !== $this->logger) {
$this->logger->err(sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage()));
}
// re-throw the exception as this is a catch-all
throw new \RuntimeException('Exception thrown when handling an exception.', 0, $e);
}
$event->setReturnValue($response);
return true;
}
开发者ID:rsky,项目名称:symfony,代码行数:27,代码来源:ExceptionListener.php
示例14: test_mimetypes
function test_mimetypes($mimetypes)
{
foreach ($mimetypes as $mimetype) {
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port) ?: 80;
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
if (!$fp) {
die('Connect failed');
}
file_put_contents(__DIR__ . "/foo.{$mimetype}", '');
$header = <<<HEADER
GET /foo.{$mimetype} HTTP/1.1
Host: {$host}
HEADER;
if (fwrite($fp, $header)) {
while (!feof($fp)) {
$text = fgets($fp);
if (strncasecmp("Content-type:", $text, 13) == 0) {
echo "foo.{$mimetype} => ", $text;
}
}
@unlink(__DIR__ . "/foo.{$mimetype}");
fclose($fp);
}
}
}
开发者ID:gleamingthecube,项目名称:php,代码行数:28,代码来源:sapi_cli_tests_bug61977.php
示例15: _CreateColumn
protected function _CreateColumn($Name, $Type, $Null, $Default, $KeyType)
{
$Length = '';
$Precision = '';
// Check to see if the type starts with a 'u' for unsigned.
if (is_string($Type) && strncasecmp($Type, 'u', 1) == 0) {
$Type = substr($Type, 1);
$Unsigned = TRUE;
} else {
$Unsigned = FALSE;
}
// Check for a length in the type.
if (is_string($Type) && preg_match('/(\\w+)\\s*\\(\\s*(\\d+)\\s*(?:,\\s*(\\d+)\\s*)?\\)/', $Type, $Matches)) {
$Type = $Matches[1];
$Length = $Matches[2];
if (count($Matches) >= 4) {
$Precision = $Matches[3];
}
}
$Column = new stdClass();
$Column->Name = $Name;
$Column->Type = is_array($Type) ? 'enum' : $Type;
$Column->Length = $Length;
$Column->Precision = $Precision;
$Column->Enum = is_array($Type) ? $Type : FALSE;
$Column->AllowNull = $Null;
$Column->Default = $Default;
$Column->KeyType = $KeyType;
$Column->Unsigned = $Unsigned;
$Column->AutoIncrement = FALSE;
return $Column;
}
开发者ID:Aetasiric,项目名称:Garden,代码行数:32,代码来源:class.databasestructure.php
示例16: toExecLsCommand
public function toExecLsCommand(CliGuy $I)
{
$command = strncasecmp(PHP_OS, 'WIN', 3) == 0 ? 'dir' : 'ls';
$res = $I->taskExec($command)->run();
verify($res->getMessage())->contains('src');
verify($res->getMessage())->contains('codeception.yml');
}
开发者ID:zondor,项目名称:Robo,代码行数:7,代码来源:ExecCest.php
示例17: run
public function run($args)
{
if (!isset($this->servers)) {
echo "No server specified in config!";
exit;
}
if (!isset($this->aliases)) {
echo "No alias defined in config!";
exit;
}
if (!isset($args[2])) {
$this->getHelp();
exit;
}
$src = $args[0];
$dest = $args[1];
$alias = $args[2];
$path = Yii::getPathOfAlias($this->aliases[$alias]);
$relativePath = str_replace(Yii::app()->basePath, "", $path);
$srcUrl = $this->servers[$src] . $relativePath . "/";
$destUrl = $this->servers[$dest] . $relativePath . "/";
echo "Start rsync of '" . $alias . "' (" . $relativePath . ") from '" . $src . "' to '" . $dest . "'? [Yes|No] ";
if (!strncasecmp(trim(fgets(STDIN)), 'y', 1)) {
$cmd = "rsync -av " . $srcUrl . " " . $destUrl;
echo "\n" . $cmd . "\n";
system($cmd, $output);
} else {
echo "Skipped.\n";
}
}
开发者ID:ranvirp,项目名称:rdp,代码行数:30,代码来源:P3RsyncCommand.php
示例18: __unset
public function __unset($name)
{
$setter = 'set' . $name;
if (method_exists($this, $setter)) {
$this->{$setter}(null);
} elseif (strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) {
unset($this->_e[strtolower($name)]);
} elseif (is_array($this->_m)) {
if (isset($this->_m[$name])) {
$this->detachBehavior($name);
} else {
foreach ($this->_m as $object) {
if ($object->getEnabled()) {
if (property_exists($object, $name)) {
return $object->{$name} = null;
} elseif ($object->canSetProperty($name)) {
return $object->{$setter}(null);
}
}
}
}
} elseif (method_exists($this, 'get' . $name)) {
throw new CException(Yii::t('yii', 'Property "{class}.{property}" is read only.', array('{class}' => get_class($this), '{property}' => $name)));
}
}
开发者ID:RandomCivil,项目名称:tiny-yii,代码行数:25,代码来源:CComponent.php
示例19: dispMessage
/**
* @brief Message output
**/
function dispMessage()
{
// Get configurations (using module model object)
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if (!$config->mskin) {
$config->mskin = 'default';
}
// Set the template path
$template_path = sprintf('%sm.skins/%s', $this->module_path, $config->mskin);
// Get the member configuration
$oModuleModel = getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $member_config);
// Set a flag to check if the https connection is made when using SSL and create https url
$ssl_mode = false;
if ($member_config->enable_ssl == 'Y') {
if (strncasecmp('https://', Context::getRequestUri(), 8) === 0) {
$ssl_mode = true;
}
}
Context::set('ssl_mode', $ssl_mode);
Context::set('system_message', nl2br($this->getMessage()));
Context::set('act', 'procMemberLogin');
Context::set('mid', '');
$this->setTemplatePath($template_path);
$this->setTemplateFile('system_message');
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:31,代码来源:message.mobile.php
示例20: getCallstack
protected function getCallstack($logs)
{
$stack = array();
$results = array();
$n = 0;
foreach ($logs as $log) {
if ($log[1] !== CLogger::LEVEL_PROFILE) {
continue;
}
$message = $log[0];
if (!strncasecmp($message, 'begin:', 6)) {
$log[0] = substr($message, 6);
$log[4] = $n;
$stack[] = $log;
$n++;
} else {
if (!strncasecmp($message, 'end:', 4)) {
$token = substr($message, 4);
if (($last = array_pop($stack)) !== null && $last[0] === $token) {
$delta = $log[3] - $last[3];
$results[$last[4]] = array($token, $delta, count($stack));
} else {
throw new CException(Yii::t('yii', 'CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', array('{token}' => $token)));
}
}
}
}
// remaining entries should be closed here
$now = microtime(true);
while (($last = array_pop($stack)) !== null) {
$results[$last[4]] = array($last[0], $now - $last[3], count($stack));
}
ksort($results);
return array_map(array($this, 'formatLog'), $results);
}
开发者ID:alexskull,项目名称:Ushi,代码行数:35,代码来源:QtzPanelRoute.php
注:本文中的strncasecmp函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论