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


PHP FLEXIUtilities::unichr方法代码示例

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


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

示例1: _buildAlphaIndexWhere

 /**
  * Method to build the part of WHERE clause related to Alpha Index
  *
  * @access private
  * @return array
  */
 function _buildAlphaIndexWhere()
 {
     // Get alpha index request variable and do some security checks, by removing any quotes and other non-valid characters
     $alpha = JRequest::getVar('letter', NULL, 'request', 'string');
     $alpha = preg_replace("/(\\(|\\)\\'|\"|\\\\)/u", "", $alpha);
     if (JString::strlen($alpha) == 0) {
         // nothing to do
         return '';
     }
     // Detect and handle character groups and character ranges,  WARNING: The following is needed because
     // utf8 is multibyte and MySQL regexp doesnot support multibyte, thus we can not use [] with utf8
     $range = explode("-", $alpha);
     if (count($range) > 2) {
         echo "Error in Alpha Index please correct letter range: " . $alpha . "<br>";
         return '';
     } else {
         if (count($range) == 1) {
             $regexp = '"^(' . JString::substr($alpha, 0, 1);
             for ($i = 1; $i < JString::strlen($alpha); $i++) {
                 $regexp .= '|' . JString::substr($alpha, $i, 1);
             }
             $regexp .= ')"';
         } else {
             if (count($range) == 2) {
                 // Get range characters
                 $startletter = $range[0];
                 $endletter = $range[1];
                 // ERROR CHECK: Range START and END are single character strings
                 if (JString::strlen($startletter) != 1 || JString::strlen($endletter) != 1) {
                     echo "Error in Alpha Index<br>letter range: " . $alpha . " start and end must be one character<br>";
                     return '';
                 }
                 // Get ord of characters and their rangle length
                 $startord = FLEXIUtilities::uniord($startletter);
                 $endord = FLEXIUtilities::uniord($endletter);
                 $range_length = $endord - $startord;
                 // ERROR CHECK: Character range has at least one character
                 if ($range_length > 50 || $range_length < 1) {
                     // A sanity check that the range is something logical and that
                     echo "Error in Alpha Index<br>letter range: " . $alpha . ", is incorrect or contains more that 50 characters<br>";
                     return '';
                 }
                 // Check if any character out of the range characters exists
                 // Meaning (There is at least on item title starting with one of the range characters)
                 $regexp = '"^(' . $startletter;
                 for ($uord = $startord + 1; $uord <= $endord; $uord++) {
                     $regexp .= '|' . FLEXIUtilities::unichr($uord);
                 }
                 $regexp .= ')"';
             } else {
                 echo "Error in Alpha Index<br>incorrect letter range: " . $alpha . "<br>";
                 return '';
             }
         }
     }
     $where = '';
     if (!empty($regexp)) {
         if ($alpha == '0') {
             $where = ' AND ( CONVERT (( i.title ) USING BINARY) REGEXP CONVERT (' . $regexp . ' USING BINARY) )';
         } elseif (!empty($alpha)) {
             $where = ' AND ( CONVERT (LOWER( i.title ) USING BINARY) REGEXP CONVERT (' . $regexp . ' USING BINARY) )';
         }
         //$alpha_term = $this->_db->escape( '^['.$alpha.']', true );
         //$where = ' AND LOWER( i.title ) RLIKE '.$this->_db->Quote( $alpha_term, false );
     }
     return $where;
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:73,代码来源:category.php

示例2:

         continue;
     }
     // Get ord of characters and their rangle length
     $startord = FLEXIUtilities::uniord($startletter);
     $endord = FLEXIUtilities::uniord($endletter);
     $range_length = $endord - $startord;
     // ERROR CHECK: Character range has at least one character
     if ($range_length > 200 || $range_length < 1) {
         // A sanity check that the range is something logical and that
         echo "Error in Alpha Index<br>letter range: " . $letter . ", is incorrect or contains more that 200 characters<br>";
         continue;
     }
     // Check if any character out of the range characters exists
     // Meaning (There is at least on item title starting with one of the range characters)
     for ($uord = $startord; $uord <= $endord; $uord++) {
         $uchar = FLEXIUtilities::unichr($uord);
         if (in_array($uchar, $this->alpha)) {
             $has_item = true;
             break;
         }
     }
 }
 if ($alphacharsep) {
     $aiclass = "btn btn-medium fc_alpha_index_sep";
 } else {
     $aiclass = "btn btn-medium fc_alpha_index";
 }
 $currentclass = '';
 if ($letter_label == $selected_letter) {
     $currentclass = 'current active';
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:31,代码来源:category_alpha_html5.php


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