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


PHP JString::strcasecmp方法代码示例

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


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

示例1: _sortObjects

 /**
  * Callback function for sorting an array of objects on a key
  *
  * @param   array    $a	An array of objects
  * @param   array    $b	An array of objects
  *
  * @return  integer  	Comparison status
  * @since   11.1
  * @see		JArrayHelper::sortObjects()
  */
 protected static function _sortObjects(&$a, &$b)
 {
     $params = $GLOBALS['JAH_so'];
     for ($i = 0, $count = count($params['key']); $i < $count; $i++) {
         if (isset($params['direction'][$i])) {
             $direction = $params['direction'][$i];
         }
         if (isset($params['casesensitive'][$i])) {
             $casesensitive = $params['casesensitive'][$i];
         }
         if (isset($params['locale'][$i])) {
             $locale = $params['locale'][$i];
         }
         $va = $a->{$params}['key'][$i];
         $vb = $b->{$params}['key'][$i];
         if ((is_bool($va) or is_numeric($va)) and (is_bool($vb) or is_numeric($vb))) {
             $cmp = $va - $vb;
         } elseif ($casesensitive) {
             $cmp = JString::strcmp($va, $vb, $locale);
         } else {
             $cmp = JString::strcasecmp($va, $vb, $locale);
         }
         if ($cmp > 0) {
             return $direction;
         }
         if ($cmp < 0) {
             return -$direction;
         }
     }
     return 0;
 }
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:41,代码来源:arrayhelper.php

示例2: _sortObjects

 /**
  * Callback function for sorting an array of objects on a key
  *
  * @param   array  &$a  An array of objects
  * @param   array  &$b  An array of objects
  *
  * @return  integer  Comparison status
  *
  * @see     JArrayHelper::sortObjects()
  * @since   11.1
  */
 protected static function _sortObjects(&$a, &$b)
 {
     $key = self::$sortKey;
     for ($i = 0, $count = count($key); $i < $count; $i++) {
         if (isset(self::$sortDirection[$i])) {
             $direction = self::$sortDirection[$i];
         }
         if (isset(self::$sortCase[$i])) {
             $caseSensitive = self::$sortCase[$i];
         }
         if (isset(self::$sortLocale[$i])) {
             $locale = self::$sortLocale[$i];
         }
         $va = $a->{$key[$i]};
         $vb = $b->{$key[$i]};
         if ((is_bool($va) || is_numeric($va)) && (is_bool($vb) || is_numeric($vb))) {
             $cmp = $va - $vb;
         } elseif ($caseSensitive) {
             $cmp = JString::strcmp($va, $vb, $locale);
         } else {
             $cmp = JString::strcasecmp($va, $vb, $locale);
         }
         if ($cmp > 0) {
             return $direction;
         }
         if ($cmp < 0) {
             return -$direction;
         }
     }
     return 0;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:42,代码来源:arrayhelper.php

示例3: revert

 function revert(&$url_array, $pos)
 {
     // V 1.2.4.l  // updated based on includes/sef.php.
     $url_array = array_filter($url_array);
     // V x : traling slash can cause empty array element
     $url_array = array_values($url_array);
     $uri = explode('content/', $_SERVER['REQUEST_URI']);
     $option = 'com_content';
     $pos = array_search('content', $url_array);
     // language hook for content
     $lang = '';
     foreach ($url_array as $key => $value) {
         if (!JString::strcasecmp(JString::substr($value, 0, 5), 'lang,')) {
             $temp = explode(',', $value);
             if (isset($temp[0]) && $temp[0] != '' && isset($temp[1]) && $temp[1] != '') {
                 $lang = $temp[1];
             }
             unset($url_array[$key]);
         }
     }
     if (isset($url_array[$pos + 8]) && $url_array[$pos + 8] != '' && in_array('category', $url_array) && strpos($url_array[$pos + 5], 'order,') !== false && strpos($url_array[$pos + 6], 'filter,') !== false) {
         // $option/$task/$sectionid/$id/$Itemid/$order/$filter/$limit/$limitstart
         $task = $url_array[$pos + 1];
         $sectionid = $url_array[$pos + 2];
         $id = $url_array[$pos + 3];
         $Itemid = $url_array[$pos + 4];
         $order = str_replace('order,', '', $url_array[$pos + 5]);
         $filter = str_replace('filter,', '', $url_array[$pos + 6]);
         $limit = $url_array[$pos + 7];
         $limitstart = $url_array[$pos + 8];
         $QUERY_STRING = "option=com_content&task={$task}&sectionid={$sectionid}&id={$id}&Itemid={$Itemid}&order={$order}&filter={$filter}&limit={$limit}&limitstart={$limitstart}";
     } else {
         if (isset($url_array[$pos + 7]) && $url_array[$pos + 7] != '' && $url_array[$pos + 5] > 1000 && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) {
             // $option/$task/$id/$limit/$limitstart/year/month/module
             $task = $url_array[$pos + 1];
             $id = $url_array[$pos + 2];
             $limit = $url_array[$pos + 3];
             $limitstart = $url_array[$pos + 4];
             $year = $url_array[$pos + 5];
             $month = $url_array[$pos + 6];
             $module = $url_array[$pos + 7];
             $QUERY_STRING = "option=com_content&task={$task}&id={$id}&limit={$limit}&limitstart={$limitstart}&year={$year}&month={$month}&module={$module}";
         } else {
             if (isset($url_array[$pos + 7]) && $url_array[$pos + 7] != '' && $url_array[$pos + 6] > 1000 && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) {
                 // $option/$task/$id/$Itemid/$limit/$limitstart/year/month
                 $task = $url_array[$pos + 1];
                 $id = $url_array[$pos + 2];
                 $Itemid = $url_array[$pos + 3];
                 $limit = $url_array[$pos + 4];
                 $limitstart = $url_array[$pos + 5];
                 $year = $url_array[$pos + 6];
                 $month = $url_array[$pos + 7];
                 $QUERY_STRING = "option=com_content&task={$task}&id={$id}&Itemid={$Itemid}&limit={$limit}&limitstart={$limitstart}&year={$year}&month={$month}";
             } else {
                 if (isset($url_array[$pos + 7]) && $url_array[$pos + 7] != '' && in_array('category', $url_array) && strpos($url_array[$pos + 5], 'order,') !== false) {
                     // $option/$task/$sectionid/$id/$Itemid/$order/$limit/$limitstart
                     $task = $url_array[$pos + 1];
                     $sectionid = $url_array[$pos + 2];
                     $id = $url_array[$pos + 3];
                     $Itemid = $url_array[$pos + 4];
                     $order = str_replace('order,', '', $url_array[$pos + 5]);
                     $limit = $url_array[$pos + 6];
                     $limitstart = $url_array[$pos + 7];
                     $QUERY_STRING = "option=com_content&task={$task}&sectionid={$sectionid}&id={$id}&Itemid={$Itemid}&order={$order}&limit={$limit}&limitstart={$limitstart}";
                 } else {
                     if (isset($url_array[$pos + 6]) && $url_array[$pos + 6] != '') {
                         // $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart
                         $task = $url_array[$pos + 1];
                         $sectionid = $url_array[$pos + 2];
                         $id = $url_array[$pos + 3];
                         $Itemid = $url_array[$pos + 4];
                         $limit = $url_array[$pos + 5];
                         $limitstart = $url_array[$pos + 6];
                         $QUERY_STRING = "option=com_content&task={$task}&sectionid={$sectionid}&id={$id}&Itemid={$Itemid}&limit={$limit}&limitstart={$limitstart}";
                     } else {
                         if (isset($url_array[$pos + 5]) && $url_array[$pos + 5] != '') {
                             // $option/$task/$id/$Itemid/$limit/$limitstart
                             $task = $url_array[$pos + 1];
                             $id = $url_array[$pos + 2];
                             $Itemid = $url_array[$pos + 3];
                             $limit = $url_array[$pos + 4];
                             $limitstart = $url_array[$pos + 5];
                             $QUERY_STRING = "option=com_content&task={$task}&id={$id}&Itemid={$Itemid}&limit={$limit}&limitstart={$limitstart}";
                         } else {
                             if (isset($url_array[$pos + 4]) && $url_array[$pos + 4] != '' && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) {
                                 // $option/$task/$year/$month/$module
                                 $task = $url_array[$pos + 1];
                                 $year = $url_array[$pos + 2];
                                 $month = $url_array[$pos + 3];
                                 $module = $url_array[$pos + 4];
                                 $QUERY_STRING = "option=com_content&task={$task}&year={$year}&month={$month}&module={$module}";
                             } else {
                                 if (!(isset($url_array[$pos + 5]) && $url_array[$pos + 5] != '') && isset($url_array[$pos + 4]) && $url_array[$pos + 4] != '') {
                                     // $option/$task/$sectionid/$id/$Itemid
                                     $task = $url_array[$pos + 1];
                                     $sectionid = $url_array[$pos + 2];
                                     $id = $url_array[$pos + 3];
                                     $Itemid = $url_array[$pos + 4];
                                     $QUERY_STRING = "option=com_content&task={$task}&sectionid={$sectionid}&id={$id}&Itemid={$Itemid}";
                                 } else {
//.........这里部分代码省略.........
开发者ID:sangkasi,项目名称:joomla,代码行数:101,代码来源:sef_ext.php

示例4: testStrcasecmp

 /**
  * @group String
  * @covers JString::strcasecmp
  * @dataProvider strcasecmpData
  */
 public function testStrcasecmp($string1, $string2, $locale, $expect)
 {
     if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) {
         $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly');
     } else {
         $actual = JString::strcasecmp($string1, $string2, $locale);
         if ($actual != 0) {
             $actual = $actual / abs($actual);
         }
         $this->assertEquals($expect, $actual);
     }
 }
开发者ID:GMaup,项目名称:joomla-platform,代码行数:17,代码来源:JStringTest.php

示例5: compareByNameDesc

 /**
  * @param $a
  * @param $b
  *
  * @return int
  */
 public static function compareByNameDesc($a, $b)
 {
     if (!isset(self::$_instances[$a]) || !isset(self::$_instances[$b])) {
         return 0;
     }
     return JString::strcasecmp(self::$_instances[$b]->name, self::$_instances[$a]->name);
 }
开发者ID:proyectoseb,项目名称:University,代码行数:13,代码来源:helper.php

示例6: testStrcasecmp

 /**
  * Test...
  *
  * @param   string  $string1  @todo
  * @param   string  $string2  @todo
  * @param   string  $locale   @todo
  * @param   string  $expect   @todo
  *
  * @return  array
  *
  * @dataProvider  getStrcasecmpData
  * @since   11.2
  * @covers  JString::strcasecmp
  */
 public function testStrcasecmp($string1, $string2, $locale, $expect)
 {
     // Convert the $locale param to a string if it is an array
     if (is_array($locale)) {
         $locale = "'" . implode("', '", $locale) . "'";
     }
     if (substr(php_uname(), 0, 6) == 'Darwin' && $locale != false) {
         $this->markTestSkipped('Darwin bug prevents foreign conversion from working properly');
     } elseif ($locale != false && !setlocale(LC_COLLATE, $locale)) {
         $this->markTestSkipped("Locale {$locale} is not available.");
     } else {
         $actual = JString::strcasecmp($string1, $string2, $locale);
         if ($actual != 0) {
             $actual = $actual / abs($actual);
         }
         $this->assertEquals($expect, $actual);
     }
 }
开发者ID:n3t,项目名称:joomla-cms,代码行数:32,代码来源:JStringTest.php

示例7: testStrcasecmp

	/**
	 * @group String
	 * @covers JString::strcasecmp
	 * @dataProvider strcasecmpData
	 */
	public function testStrcasecmp($string1, $string2, $locale, $expect)
	{
		if (substr(php_uname(), 0, 6) != 'Darwin') {
			$actual = JString::strcasecmp ($string1, $string2, $locale);
			if ($actual != 0) {
				$actual = $actual/abs($actual);
			}
			$this->assertEquals($expect, $actual);
		}
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:15,代码来源:JStringTest.php


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