* Finish task #38280.

This commit is contained in:
holan20180123
2021-05-20 10:36:25 +08:00
parent be80ce2e0f
commit 43dc4b74f4
2 changed files with 25 additions and 14 deletions
+23 -12
View File
@@ -8,22 +8,22 @@
* @package spliter
* @version $Id$
* @link http://www.chanzhi.org
* @see http://www.cnblogs.com/chenwenbiao/archive/2011/08/11/2134503.html
* @see http://www.cnblogs.com/chenwenbiao/archive/2011/08/11/2134503.html
* @see http://stackoverflow.com/questions/9361303/can-i-get-the-unicode-value-of-a-character-or-vise-versa-with-php
*/
class spliter
{
/**
* Split a utf-8 string into words, computing unicode for every word.
*
* @param string $string
*
* @param string $string
* @access public
* @return array
*/
public function utf8Split($string)
{
$string = strtolower($string);
$i = 0;
$i = 0;
$length = strlen($string);
$dict = array();
$words = '';
@@ -50,12 +50,16 @@ class spliter
$word .= $letter;
$i++;
}
/* Process intigers. */
if(is_numeric($word) and (strpos($word, '.') === false)) $word = "|" . $word . "|";
$word = str_pad(strtolower($word), 5, '_');
$words .= ' ' . $word;
}
elseif($ord == 32)
{
$words .= ' ';
}
continue;
}
@@ -76,7 +80,14 @@ class spliter
}
else
{
$words .= ' ' . $letter;
if(is_numeric(substr($words, strlen($words) - 1, 1)))
{
$words .= ' ' . $letter;
}
else
{
$words .= $letter;
}
}
$i += $offset;
}
@@ -86,13 +97,13 @@ class spliter
}
/**
* Return unicode value for a char.
*
* @param string $c
* Return unicode value for a char.
*
* @param string $c
* @access public
* @return int
*/
public function unicode($c)
public function unicode($c)
{
if(ord($c{0}) >= 0 && ord($c{0}) <= 127) return ord($c{0});
if(ord($c{0}) >= 192 && ord($c{0}) <= 223) return (ord($c{0}) - 192) * 64 + (ord($c{1}) - 128);
@@ -107,8 +118,8 @@ class spliter
/**
* Judge a char is Letter or not.
*
* @param string $letter
*
* @param string $letter
* @access public
* @return bool
*/
+2 -2
View File
@@ -836,7 +836,7 @@ class taskModel extends model
->setIF($oldTask->parent < 0, 'estimate', $oldTask->estimate)
->setIF($oldTask->parent < 0, 'left', $oldTask->left)
->setIF($oldTask->name != $task->name || $oldTask->estStarted != $task->estStarted || $oldTask->deadline != $task->deadline, 'version', $oldTask->version + 1)
->setIF($oldTask->name != $this->post->name || $oldTask->estStarted != $this->post->estStarted || $oldTask->deadline != $this->post->deadline, 'version', $oldTask->version + 1)
->setDefault('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
@@ -947,7 +947,7 @@ class taskModel extends model
}
/* Record task version. */
if($task->version > $oldTask->version)
if(isset($task->version) and $task->version > $oldTask->version)
{
$taskSpec = new stdClass();
$taskSpec->task = $taskID;