本文整理汇总了PHP中strcasecmp函数的典型用法代码示例。如果您正苦于以下问题:PHP strcasecmp函数的具体用法?PHP strcasecmp怎么用?PHP strcasecmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strcasecmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unmarshalFrom
/**
* Unmarshal return value from a specified node
*
* @param xml.Node node
* @return webservices.uddi.BusinessList
* @see xp://webservices.uddi.UDDICommand#unmarshalFrom
* @throws lang.FormatException in case of an unexpected response
*/
public function unmarshalFrom($node)
{
if (0 != strcasecmp($node->name, 'businessList')) {
throw new \lang\FormatException('Expected "businessList", got "' . $node->name . '"');
}
// Create business list object from XML representation
with($list = new BusinessList(), $children = $node->nodeAt(0)->getChildren());
$list->setOperator($node->getAttribute('operator'));
$list->setTruncated(0 == strcasecmp('true', $node->getAttribute('truncated')));
for ($i = 0, $s = sizeof($children); $i < $s; $i++) {
$b = new Business($children[$i]->getAttribute('businessKey'));
for ($j = 0, $t = sizeof($children[$i]->getChildren()); $j < $s; $j++) {
switch ($children[$i]->nodeAt($j)->name) {
case 'name':
$b->names[] = $children[$i]->nodeAt($j)->getContent();
break;
case 'description':
$b->description = $children[$i]->nodeAt($j)->getContent();
break;
}
}
$list->items[] = $b;
}
return $list;
}
示例2: getAllProjects
public function getAllProjects()
{
$key = "{$this->cachePrefix}-all-projects";
if ($this->cache && ($projects = $this->cache->fetch($key))) {
return $projects;
}
$first = json_decode($this->client->get('projects.json', ['query' => ['limit' => 100]])->getBody(), true);
$projects = $first['projects'];
if ($first['total_count'] > 100) {
$requests = [];
for ($i = 100; $i < $first['total_count']; $i += 100) {
$requests[] = $this->client->getAsync('projects.json', ['query' => ['limit' => 100, 'offset' => $i]]);
}
/** @var Response[] $responses */
$responses = Promise\unwrap($requests);
$responseProjects = array_map(function (Response $response) {
return json_decode($response->getBody(), true)['projects'];
}, $responses);
$responseProjects[] = $projects;
$projects = call_user_func_array('array_merge', $responseProjects);
}
usort($projects, function ($projectA, $projectB) {
return strcasecmp($projectA['name'], $projectB['name']);
});
$this->cache && $this->cache->save($key, $projects);
return $projects;
}
示例3: getTableFieldList
protected function getTableFieldList($tableName)
{
$tableFieldList = array();
$factory = WebserviceField::fromArray($this->pearDB, array('tablename' => $tableName));
$dbTableFields = $factory->getTableFields();
foreach ($dbTableFields as $dbField) {
if ($dbField->primaryKey) {
if ($this->idColumn === null) {
$this->idColumn = $dbField->name;
} else {
throw new WebServiceException(WebServiceErrorCode::$UNKOWNENTITY, "Entity table with multi column primary key is not supported");
}
}
$field = $this->getFieldArrayFromDBField($dbField, $tableName);
$webserviceField = WebserviceField::fromArray($this->pearDB, $field);
$fieldDataType = $this->getFieldType($dbField, $tableName);
if ($fieldDataType === null) {
$fieldDataType = $this->getFieldDataTypeFromDBType($dbField->type);
}
$webserviceField->setFieldDataType($fieldDataType);
if (strcasecmp($fieldDataType, 'reference') === 0) {
$webserviceField->setReferenceList($this->getReferenceList($dbField, $tableName));
}
array_push($tableFieldList, $webserviceField);
}
return $tableFieldList;
}
示例4: call_elucidat
/**
* Makes an API request to elucidat
* @param $headers
* @param $fields
* @param $url
* @param $consumer_secret
* @return mixed
*/
function call_elucidat($headers, $fields, $method, $url, $consumer_secret)
{
//Build a signature
$headers['oauth_signature'] = build_signature($consumer_secret, array_merge($headers, $fields), $method, $url);
//Build OAuth headers
$auth_headers = 'Authorization:';
$auth_headers .= build_base_string($headers, ',');
//Build the request string
$fields_string = build_base_string($fields, '&');
//Set the headers
$header = array($auth_headers, 'Expect:');
// Create curl options
if (strcasecmp($method, "GET") == 0) {
$url .= '?' . $fields_string;
$options = array(CURLOPT_HTTPHEADER => $header, CURLOPT_HEADER => false, CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false);
} else {
$options = array(CURLOPT_HTTPHEADER => $header, CURLOPT_HEADER => false, CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => count($fields), CURLOPT_POSTFIELDS => $fields_string);
}
//Init the request and set its params
$request = curl_init();
curl_setopt_array($request, $options);
//Make the request
$response = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
curl_close($request);
return array('status' => $status, 'response' => json_decode($response, true));
}
示例5: get_profile_url
function get_profile_url($html)
{
$profiles = array();
$keys = array();
$doc = new \DOMDocument();
$html = "<html><head> <title> test </title> </head> <body> " . $html . "</body> </html>";
@$doc->loadHTML($html);
$links = $doc->getElementsByTagName("a");
$length = $links->length;
if ($length <= 0) {
return $profiles;
}
for ($i = 0; $i < $length; $i++) {
//individual link node
$link = $links->item($i);
$href = $link->getAttribute("href");
//does the link href end in profile?
$pos = strrpos($href, "/");
if ($pos !== false) {
$token = substr($href, $pos + 1);
if (strcasecmp($token, "profile") == 0) {
$key = md5($href);
//avoid duplicates!
if (!in_array($key, $keys)) {
array_push($profiles, $href);
array_push($keys, $key);
}
}
}
}
return $profiles;
}
示例6: strtoupper
function &getTransport($url, $encoding = SOAP_DEFAULT_ENCODING)
{
$urlparts = @parse_url($url);
if (!$urlparts['scheme']) {
return SOAP_Base_Object::_raiseSoapFault("Invalid transport URI: {$url}");
}
if (strcasecmp($urlparts['scheme'], 'mailto') == 0) {
$transport_type = 'SMTP';
} else {
if (strcasecmp($urlparts['scheme'], 'https') == 0) {
$transport_type = 'HTTP';
} else {
/* handle other transport types */
$transport_type = strtoupper($urlparts['scheme']);
}
}
$transport_include = 'SOAP/Transport/' . $transport_type . '.php';
$res = @(include_once $transport_include);
if (!$res && !in_array($transport_include, get_included_files())) {
return SOAP_Base_Object::_raiseSoapFault("No Transport for {$urlparts['scheme']}");
}
$transport_class = "SOAP_Transport_{$transport_type}";
if (!class_exists($transport_class)) {
return SOAP_Base_Object::_raiseSoapFault("No Transport class {$transport_class}");
}
return new $transport_class($url, $encoding);
}
示例7: requestForgotPassword
public function requestForgotPassword($request)
{
$request = new Vtiger_Request($request);
$adb = PearDatabase::getInstance();
$username = vtlib_purify($request->get('user_name'));
$result = $adb->pquery('select id,email1 from vtiger_users where user_name = ? ', array($username));
if ($adb->num_rows($result) > 0) {
$email = $adb->query_result($result, 0, 'email1');
}
if (strcasecmp($request->get('emailId'), $email) === 0) {
$userId = $adb->query_result($result, 0, 'id');
$time = time();
$options = array('handler_path' => 'modules/Users/handlers/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email, 'time' => $time, 'hash' => md5($username . $time)));
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$data = ['sysname' => 'UsersForgotPassword', 'to_email' => $email, 'module' => 'Users', 'record' => $userId, 'trackURL' => $trackURL];
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
$status = $recordModel->sendMailFromTemplate($data);
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
if ($status === 1) {
header('Location: ' . $site_URL . '&status=1');
} else {
header('Location: ' . $site_URL . '&statusError=1');
}
} else {
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
header('Location: ' . $site_URL . '&fpError=1');
}
}
示例8: factory
/**
* Factory
*
* @param string $backend backend name
* @param array $backendOptions associative array of options for the corresponding backend constructor
* @return Zend_Memory_Manager
* @throws Zend_Memory_Exception
*/
public static function factory($backend, $backendOptions = array())
{
if (strcasecmp($backend, 'none') == 0) {
return new Zend_Memory_Manager();
}
// Look through available backendsand
// (that allows to specify it in any case)
$backendIsFound = false;
foreach (Zend_Cache::$standardBackends as $zendCacheBackend) {
if (strcasecmp($backend, $zendCacheBackend) == 0) {
$backend = $zendCacheBackend;
$backendIsFound = true;
break;
}
}
if (!$backendIsFound) {
// require_once 'Zend/Memory/Exception.php';
throw new Zend_Memory_Exception("Incorrect backend ({$backend})");
}
$backendClass = 'Zend_Cache_Backend_' . $backend;
// For perfs reasons, we do not use the Zend_Loader::loadClass() method
// (security controls are explicit)
// require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
$backendObject = new $backendClass($backendOptions);
return new Zend_Memory_Manager($backendObject);
}
示例9: validate
/**
* 最大値のチェックを行う
*
* @access public
* @param string $name フォームの名前
* @param mixed $var フォームの値
* @param array $params プラグインのパラメータ
* @return true: 成功 Ethna_Error: エラー
*/
public function validate($name, $var, $params)
{
$true = true;
$type = $this->getFormType($name);
if (isset($params['strmaxcompat']) == false || $this->isEmpty($var, $type)) {
return $true;
}
$ctl = $this->backend->getController();
$client_enc = $ctl->getClientEncoding();
if (mb_enabled() && (strcasecmp('EUC-JP', $client_enc) != 0 && strcasecmp('eucJP-win', $client_enc) != 0)) {
$var = mb_convert_encoding($var, 'EUC-JP', $client_enc);
}
if ($type == VAR_TYPE_STRING) {
$max_param = $params['strmaxcompat'];
if (strlen($var) > $max_param) {
if (isset($params['error'])) {
$msg = $params['error'];
} else {
$msg = _et('Please input less than %d full-size (%d half-size) characters to {form}.');
}
return Ethna::raiseNotice($msg, E_FORM_MAX_STRING, array(intval($max_param / 2), $max_param));
}
}
return $true;
}
示例10: simple_fields_uasort
function simple_fields_uasort($a, $b)
{
if ($a["name"] == $b["name"]) {
return 0;
}
return strcasecmp($a["name"], $b["name"]);
}
示例11: curl
public function curl($server = NULL, $parameters = array())
{
$response = false;
$start = microtime(true);
if ($server) {
$this->CI->curl->create($server);
$this->CI->curl->option('buffersize', 10);
$this->CI->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)');
$this->CI->curl->option('returntransfer', true);
$this->CI->curl->option('followlocation', true);
$this->CI->curl->option('connecttimeout', true);
$this->CI->curl->post($parameters);
$data = $this->CI->curl->execute();
$this->CI->response_time = round(microtime(true) - $start, 3) . " seconds";
if ($data !== false) {
if (strcasecmp(element('format', $parameters), 'json') == 0) {
$response = json_decode($data, true);
} else {
$response = $data;
}
$this->CI->notification->set_message('idol_server_response_success');
} else {
$this->CI->notification->set_error('idol_server_response_error');
}
$this->CI->curl->close();
} else {
$this->CI->notification->set_error('idol_server_response_noserverdefined');
}
return $response;
}
示例12: is_soap_fault
function is_soap_fault($obj)
{
if (!is_object($obj)) {
return false;
}
return strcasecmp(get_class($obj), 'soap_fault') === 0;
}
示例13: handle_md5
function handle_md5($string)
{
if (strcasecmp(substr($string, 0, 1), "0") == 0) {
$string = substr($string, 1);
}
return $string;
}
示例14: getOptions
/**
* {@inheritdoc}
*/
public function getOptions($dataLocale, $collectionId = null, $search = '', array $options = [])
{
if (null === $collectionId) {
throw new \InvalidArgumentException('Please supply attribute id as collectionId');
}
$qb = $this->createQueryBuilder('o')->select('o.id, o.code, v.value AS label, a.properties')->leftJoin('o.optionValues', 'v', 'WITH', 'v.locale=:locale')->leftJoin('o.attribute', 'a')->where('o.attribute=:attribute')->orderBy('o.sortOrder')->setParameter('locale', $dataLocale)->setParameter('attribute', $collectionId);
if ($search) {
$qb->andWhere('v.value like :search OR o.code LIKE :search')->setParameter('search', "{$search}%");
}
if (isset($options['ids'])) {
$qb->andWhere($qb->expr()->in('o.id', ':ids'))->setParameter('ids', $options['ids']);
}
if (isset($options['limit'])) {
$qb->setMaxResults((int) $options['limit']);
if (isset($options['page'])) {
$qb->setFirstResult((int) $options['limit'] * ((int) $options['page'] - 1));
}
}
$results = [];
$autoSorting = null;
foreach ($qb->getQuery()->getArrayResult() as $row) {
if (null === $autoSorting && isset($row['properties']['autoOptionSorting'])) {
$autoSorting = $row['properties']['autoOptionSorting'];
}
$results[] = ['id' => isset($options['type']) && 'code' === $options['type'] ? $row['code'] : $row['id'], 'text' => null !== $row['label'] ? $row['label'] : sprintf('[%s]', $row['code'])];
}
if ($autoSorting) {
usort($results, function ($first, $second) {
return strcasecmp($first['text'], $second['text']);
});
}
return ['results' => $results];
}
示例15: checkUrlMatch
private function checkUrlMatch($regx, $rule)
{
$m1 = explode('/', $regx);
$m2 = explode('/', $rule);
$match = true;
// 是否匹配
foreach ($m2 as $key => $val) {
if (':' == substr($val, 0, 1)) {
// 动态变量
if (strpos($val, '\\')) {
$type = substr($val, -1);
if ('d' == $type && !is_numeric($m1[$key])) {
$match = false;
break;
}
} elseif (strpos($val, '^')) {
$array = explode('|', substr(strstr($val, '^'), 1));
if (in_array($m1[$key], $array)) {
$match = false;
break;
}
}
} elseif (0 !== strcasecmp($val, $m1[$key])) {
$match = false;
break;
}
}
return $match;
}