SluggedBehavior.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2008, Andy Dawson
  4. * @author Andy Dawson
  5. * @author Mark Scherer
  6. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  7. */
  8. App::uses('ModelBehavior', 'Model');
  9. /**
  10. * SluggedBehavior
  11. *
  12. * Part based/inspired by the sluggable behavior of Mariano Iglesias
  13. */
  14. class SluggedBehavior extends ModelBehavior {
  15. /**
  16. * Default config
  17. *
  18. * - length
  19. * Set to 0 for no length. Will be auto-detected if possible via schema.
  20. * - label
  21. * set to the name of a field to use for the slug, an array of fields to use as slugs or leave as null to rely
  22. * on the format returned by find('list') to determine the string to use for slugs
  23. * - overwrite has 2 values
  24. * false - once the slug has been saved, do not change it (use if you are doing lookups based on slugs)
  25. * true - if the label field values change, regenerate the slug (use if you are the slug is just window-dressing)
  26. * - unique has 2 values
  27. * false - will not enforce a unique slug, whatever the label is is direclty slugged without checking for duplicates
  28. * true - use if you are doing lookups based on slugs (see overwrite)
  29. * - mode has the following values
  30. * ascii - retuns an ascii slug generated using the core Inflector::slug() function
  31. * display - a dummy mode which returns a slug legal for display - removes illegal (not unprintable) characters
  32. * url - returns a slug appropriate to put in a URL
  33. * class - a dummy mode which returns a slug appropriate to put in a html class (there are no restrictions)
  34. * id - retuns a slug appropriate to use in a html id
  35. * - case has the following values
  36. * null - don't change the case of the slug
  37. * low - force lower case. E.g. "this-is-the-slug"
  38. * up - force upper case E.g. "THIS-IS-THE-SLUG"
  39. * title - force title case. E.g. "This-Is-The-Slug"
  40. * camel - force CamelCase. E.g. "ThisIsTheSlug"
  41. *
  42. * If you need to support more transliterations, make sure you adjust Inflection accordingly:
  43. * Inflector::rules('transliteration', array('/α/' => 'a', '/β/' => 'b'));
  44. *
  45. * @var array
  46. */
  47. protected $_defaultConfig = array(
  48. 'label' => null,
  49. 'slugField' => 'slug',
  50. 'overwriteField' => 'overwrite_slug',
  51. 'mode' => 'url',
  52. 'separator' => '-',
  53. 'defaultSuffix' => null,
  54. 'length' => null,
  55. 'overwrite' => false,
  56. 'unique' => false,
  57. 'notices' => true,
  58. 'case' => null,
  59. 'replace' => array(
  60. '&' => 'and',
  61. '+' => 'and',
  62. '#' => 'hash',
  63. ),
  64. 'run' => 'beforeValidate',
  65. 'language' => null,
  66. 'encoding' => null,
  67. 'trigger' => null,
  68. 'scope' => array(),
  69. 'currencies' => false,
  70. );
  71. /**
  72. * Setup method
  73. *
  74. * Use the model's label field as the default field on which to base the slug, the label can be made up of multiple
  75. * fields by specifying an array of fields
  76. *
  77. * @param Model $Model
  78. * @param array $config
  79. * @return void
  80. */
  81. public function setup(Model $Model, $config = array()) {
  82. $defaults = array(
  83. 'notices' => Configure::read('debug'),
  84. 'label' => array($Model->displayField)
  85. );
  86. $defaults += $this->_defaultConfig;
  87. foreach ($defaults['replace'] as $key => $value) {
  88. $defaults['replace'][$key] = __($value);
  89. }
  90. $config += (array)Configure::read('Slugged');
  91. $config += $defaults;
  92. if ($config['length'] === null) {
  93. $schema = $Model->schema($config['slugField']);
  94. $length = !empty($schema['length']) ? $schema['length'] : 0;
  95. $config['length'] = $length;
  96. }
  97. $this->settings[$Model->alias] = $config;
  98. extract($this->settings[$Model->alias]);
  99. $label = $this->settings[$Model->alias]['label'] = (array)$label;
  100. if ($Model->Behaviors->loaded('Translate')) {
  101. $notices = false;
  102. }
  103. if ($notices) {
  104. foreach ($label as $field) {
  105. $alias = $Model->alias;
  106. if (strpos($field, '.')) {
  107. list($alias, $field) = explode('.', $field);
  108. if (!$Model->$alias->hasField($field)) {
  109. trigger_error('(SluggedBehavior::setup) model ' . $Model->$alias->name . ' is missing the field ' . $field .
  110. ' (specified in the setup for model ' . $Model->name . ') ', E_USER_WARNING);
  111. $Model->Behaviors->disable($this->name);
  112. }
  113. } elseif (!$Model->hasField($field)) {
  114. trigger_error('(SluggedBehavior::setup) model ' . $Model->name . ' is missing the field ' . $field . ' specified in the setup.', E_USER_WARNING);
  115. $Model->Behaviors->disable($this->name);
  116. }
  117. }
  118. }
  119. }
  120. /**
  121. * BeforeCallback method for common logic for beforeValidate and beforeSave callbacks
  122. *
  123. * @param string $callback
  124. * @param Model $model
  125. * @param array $options
  126. * @return bool Success
  127. */
  128. protected function _beforeCallback($callback, Model $Model, $options = array()) {
  129. extract($this->settings[$Model->alias]);
  130. if ($run !== $callback) {
  131. return true;
  132. }
  133. if (is_string($this->settings[$Model->alias]['trigger'])) {
  134. if (!$Model->{$this->settings[$Model->alias]['trigger']}) {
  135. return true;
  136. }
  137. }
  138. $this->generateSlug($Model);
  139. return true;
  140. }
  141. /**
  142. * BeforeValidate method
  143. *
  144. * @param Model $Model
  145. * @param array $options
  146. * @return bool Success
  147. */
  148. public function beforeValidate(Model $Model, $options = array()) {
  149. return $this->_beforeCallback('beforeValidate', $Model, $options);
  150. }
  151. /**
  152. * BeforeSave method
  153. *
  154. * @param Model $Model
  155. * @param array $options
  156. * @return bool Success
  157. */
  158. public function beforeSave(Model $Model, $options = array()) {
  159. return $this->_beforeCallback('beforeSave', $Model, $options);
  160. }
  161. /**
  162. * Generate slug method
  163. *
  164. * If a new row, or overwrite is set to true, check for a change to a label field and add the slug to the data
  165. * to be saved
  166. *
  167. * @param Model $Model
  168. * @return void
  169. */
  170. public function generateSlug(Model $Model) {
  171. extract($this->settings[$Model->alias]);
  172. if ($notices && !$Model->hasField($slugField)) {
  173. return;
  174. }
  175. if (!$overwrite && !empty($Model->data[$Model->alias][$overwriteField])) {
  176. $overwrite = true;
  177. }
  178. if ($overwrite || !$Model->id) {
  179. if ($label) {
  180. $somethingToDo = false;
  181. foreach ($label as $field) {
  182. $alias = $Model->alias;
  183. if (strpos($field, '.') !== false) {
  184. list($alias, $field) = explode('.', $field, 2);
  185. }
  186. if (isset($Model->data[$alias][$field])) {
  187. $somethingToDo = true;
  188. }
  189. }
  190. if (!$somethingToDo) {
  191. return;
  192. }
  193. $slug = array();
  194. foreach ($label as $field) {
  195. $alias = $Model->alias;
  196. if (strpos($field, '.')) {
  197. list($alias, $field) = explode('.', $field);
  198. }
  199. if (isset($Model->data[$alias][$field])) {
  200. if (is_array($Model->data[$alias][$field])) {
  201. return $this->_multiSlug($Model);
  202. }
  203. $slug[] = $Model->data[$alias][$field];
  204. } elseif ($Model->id) {
  205. $slug[] = $Model->field($field);
  206. }
  207. }
  208. $slug = implode($slug, $separator);
  209. } else {
  210. $slug = $this->display($Model);
  211. }
  212. $slug = $Model->slug($slug);
  213. $this->_addToWhitelist($Model, array($slugField));
  214. $Model->data[$Model->alias][$slugField] = $slug;
  215. }
  216. }
  217. /**
  218. * Slug method
  219. *
  220. * For the given string, generate a slug. The replacements used are based on the mode setting, If tidy is false
  221. * (only possible if directly called - primarily for tracing and testing) separators will not be cleaned up
  222. * and so slugs like "-----as---df-----" are possible, which by default would otherwise be returned as "as-df".
  223. * If the mode is "id" and the first charcter of the regex-ed slug is numeric, it will be prefixed with an x.
  224. * If unique is set to true, check for a unique slug and if unavailable suffix the slug with -1, -2, -3 etc.
  225. * until a unique slug is found
  226. *
  227. * @param Model $Model
  228. * @param mixed $string
  229. * @param bool $tidy
  230. * @return string a slug
  231. */
  232. public function slug(Model $Model, $string, $tidy = true) {
  233. extract($this->settings[$Model->alias]);
  234. $this->_setEncoding($Model, $encoding, $string, !Configure::read('debug'));
  235. $string = str_replace(array("\r\n", "\r", "\n"), ' ', $string);
  236. if ($replace) {
  237. $string = str_replace(array_keys($replace), array_values($replace), $string);
  238. }
  239. if ($mode === 'ascii') {
  240. $slug = $this->_slug($Model, $string, $separator);
  241. } else {
  242. $regex = $this->_regex($mode);
  243. if ($regex) {
  244. $slug = $this->_pregReplace('@[' . $regex . ']@Su', $separator, $string, $encoding);
  245. } else {
  246. $slug = $string;
  247. }
  248. }
  249. if ($tidy) {
  250. $slug = $this->_pregReplace('/' . $separator . '+/', $separator, $slug, $encoding);
  251. $slug = trim($slug, $separator);
  252. if ($slug && $mode === 'id' && is_numeric($slug[0])) {
  253. $slug = 'x' . $slug;
  254. }
  255. }
  256. if ($length && strlen($slug) > $length) {
  257. $slug = mb_substr($slug, 0, $length);
  258. while ($slug && strlen($slug) > $length) {
  259. $slug = mb_substr($slug, 0, mb_strlen($slug) - 1);
  260. }
  261. }
  262. if ($case) {
  263. if ($case === 'up') {
  264. $slug = mb_strtoupper($slug);
  265. } else {
  266. $slug = mb_strtolower($slug);
  267. }
  268. if (in_array($case, array('title', 'camel'))) {
  269. $words = explode($separator, $slug);
  270. foreach ($words as $i => &$word) {
  271. $firstChar = mb_substr($word, 0, 1);
  272. $rest = mb_substr($word, 1, mb_strlen($word) - 1);
  273. $firstCharUp = mb_strtoupper($firstChar);
  274. $word = $firstCharUp . $rest;
  275. }
  276. if ($case === 'title') {
  277. $slug = implode($words, $separator);
  278. } elseif ($case === 'camel') {
  279. $slug = implode($words);
  280. }
  281. }
  282. }
  283. if ($unique) {
  284. $conditions = array($Model->alias . '.' . $slugField => $slug);
  285. $conditions = array_merge($conditions, $this->settings[$Model->alias]['scope']);
  286. if ($Model->id) {
  287. $conditions['NOT'][$Model->alias . '.' . $Model->primaryKey] = $Model->id;
  288. }
  289. $i = 0;
  290. $suffix = '';
  291. while ($Model->hasAny($conditions)) {
  292. $i++;
  293. $suffix = $separator . $i;
  294. if ($length && strlen($slug . $suffix) > $length) {
  295. $slug = substr($slug, 0, $length - strlen($suffix));
  296. }
  297. $conditions[$Model->alias . '.' . $slugField] = $slug . $suffix;
  298. }
  299. if ($suffix) {
  300. $slug .= $suffix;
  301. }
  302. }
  303. return $slug;
  304. }
  305. /**
  306. * SluggedBehavior::_slug()
  307. *
  308. * @param Model $Model
  309. * @param string $string
  310. * @param string $separator
  311. * @return string
  312. */
  313. protected function _slug(Model $Model, $string, $separator) {
  314. $currencies = array(
  315. '$' => 'USD',
  316. '€' => 'EUR',
  317. '£' => 'GBP',
  318. '¥' => 'JPY',
  319. );
  320. if ($this->settings[$Model->alias]['currencies']) {
  321. if (is_array($this->settings[$Model->alias]['currencies'])) {
  322. $currencies = $this->settings[$Model->alias]['currencies'] + $currencies;
  323. }
  324. $string = str_replace(array_keys($currencies), array_values($currencies), $string);
  325. }
  326. $symbolMap = array(
  327. '©' => 'c'
  328. );
  329. $string = str_replace(array_keys($symbolMap), array_values($symbolMap), $string);
  330. return Inflector::slug($string, $separator);
  331. }
  332. /**
  333. * Display method
  334. *
  335. * Cheat - use find('list') and assume it has been modified such that lists show in the desired format.
  336. * First check (since this method is called in beforeSave) if there is data to be saved, and use that
  337. * to get the display name
  338. * Otherwise, read from the database
  339. *
  340. * @param mixed $id
  341. * @return mixed string (the display name) or false
  342. */
  343. public function display(Model $Model, $id = null) {
  344. if (!$id) {
  345. if (!$Model->id) {
  346. return false;
  347. }
  348. $id = $Model->id;
  349. }
  350. $conditions = array_merge(array(
  351. $Model->alias . '.' . $Model->primaryKey => $id),
  352. $this->settings[$Model->alias]['scope']);
  353. return current($Model->find('list', array('conditions' => $conditions)));
  354. }
  355. /**
  356. * ResetSlugs method.
  357. *
  358. * Regenerate all slugs. On large dbs this can take more than 30 seconds - a time
  359. * limit is set to allow a minimum 100 updates per second as a preventative measure.
  360. *
  361. * @param AppModel $Model
  362. * @param array $conditions
  363. * @param int $recursive
  364. * @return bool Success
  365. */
  366. public function resetSlugs(Model $Model, $params = array()) {
  367. $recursive = -1;
  368. extract($this->settings[$Model->alias]);
  369. if ($notices && !$Model->hasField($slugField)) {
  370. return false;
  371. }
  372. $defaults = array(
  373. 'page' => 1,
  374. 'limit' => 100,
  375. 'fields' => array_merge(array($Model->primaryKey), $label),
  376. 'order' => $Model->displayField . ' ASC',
  377. 'conditions' => $scope,
  378. 'recursive' => $recursive,
  379. 'overwrite' => true,
  380. );
  381. $params = array_merge($defaults, $params);
  382. $count = $Model->find('count', compact('conditions'));
  383. $max = ini_get('max_execution_time');
  384. if ($max) {
  385. set_time_limit(max($max, $count / 100));
  386. }
  387. $settings = $Model->Behaviors->Slugged->settings[$Model->alias];
  388. $Model->Behaviors->load('Tools.Slugged', $params + $settings);
  389. while ($rows = $Model->find('all', $params)) {
  390. foreach ($rows as $row) {
  391. $Model->create();
  392. $options = array(
  393. 'validate' => true,
  394. 'fieldList' => array_merge(array($Model->primaryKey, $slugField), $label)
  395. );
  396. if (!$Model->save($row, $options)) {
  397. throw new RuntimeException(print_r($row[$Model->alias], true) . ': ' . print_r($Model->validationErrors, true));
  398. }
  399. }
  400. $params['page']++;
  401. }
  402. return true;
  403. }
  404. /**
  405. * Multi slug method
  406. *
  407. * Handle both slug and label fields using the translate behavior, and being edited
  408. * in multiple locales at once
  409. *
  410. * @param Model $Model
  411. * @return void
  412. */
  413. protected function _multiSlug(Model $Model) {
  414. extract($this->settings[$Model->alias]);
  415. $data = $Model->data;
  416. $field = current($label);
  417. foreach ($Model->data[$Model->alias][$field] as $locale => $_) {
  418. foreach ($label as $field) {
  419. if (is_array($data[$Model->alias][$field])) {
  420. $Model->data[$Model->alias][$field] = $Model->slug($data[$Model->alias][$field][$locale]);
  421. }
  422. }
  423. $this->beforeValidate($Model);
  424. $data[$Model->alias][$slugField][$locale] = $Model->data[$Model->alias][$field];
  425. }
  426. $Model->data = $data;
  427. }
  428. /**
  429. * Wrapper for preg replace taking care of encoding
  430. *
  431. * @param mixed $pattern
  432. * @param mixed $replace
  433. * @param mixed $string
  434. * @param string $encoding
  435. * @return void
  436. */
  437. protected function _pregReplace($pattern, $replace, $string, $encoding = 'UTF-8') {
  438. if ($encoding && $encoding !== 'UTF-8') {
  439. $string = mb_convert_encoding($string, 'UTF-8', $encoding);
  440. }
  441. $return = preg_replace($pattern, $replace, $string);
  442. if ($encoding && $encoding !== 'UTF-8') {
  443. $return = mb_convert_encoding($return, $encoding, 'UTF-8');
  444. }
  445. return $return;
  446. }
  447. /**
  448. * SetEncoding method
  449. *
  450. * @param Model $Model
  451. * @param mixed $encoding null
  452. * @param mixed $string
  453. * @param mixed $reset null
  454. * @return void
  455. */
  456. protected function _setEncoding(Model $Model, &$encoding = null, &$string, $reset = null) {
  457. if (function_exists('mb_internal_encoding')) {
  458. $aEncoding = Configure::read('App.encoding');
  459. if ($aEncoding) {
  460. if (!$encoding) {
  461. $encoding = $aEncoding;
  462. } elseif ($encoding !== $aEncoding) {
  463. $string = mb_convert_encoding($string, $encoding, $aEncoding);
  464. }
  465. } else {
  466. $encoding = $aEncoding;
  467. }
  468. if ($encoding) {
  469. mb_internal_encoding($encoding);
  470. }
  471. }
  472. }
  473. /**
  474. * Regex method
  475. *
  476. * Based upon the mode return a partial regex to generate a valid string for the intended use. Note that you
  477. * can use almost litterally anything in a url - the limitation is only in what your own application
  478. * understands. See the test case for info on how these regex patterns were generated.
  479. *
  480. * @param string $mode
  481. * @return string a partial regex or false on failure
  482. */
  483. protected function _regex($mode) {
  484. $return = '\x00-\x1f\x26\x3c\x7f-\x9f\x{fffe}-\x{ffff}';
  485. if ($mode === 'display') {
  486. return $return;
  487. }
  488. $return .= preg_quote(' \'"/?<>.$/:;?@=+&%\#', '@');
  489. if ($mode === 'url') {
  490. return $return;
  491. }
  492. $return .= '';
  493. if ($mode === 'class') {
  494. return $return;
  495. }
  496. if ($mode === 'id') {
  497. return '\x{0000}-\x{002f}\x{003a}-\x{0040}\x{005b}-\x{005e}\x{0060}\x{007b}-\x{007e}\x{00a0}-\x{00b6}' .
  498. '\x{00b8}-\x{00bf}\x{00d7}\x{00f7}\x{0132}-\x{0133}\x{013f}-\x{0140}\x{0149}\x{017f}\x{01c4}-\x{01cc}' .
  499. '\x{01f1}-\x{01f3}\x{01f6}-\x{01f9}\x{0218}-\x{024f}\x{02a9}-\x{02ba}\x{02c2}-\x{02cf}\x{02d2}-\x{02ff}' .
  500. '\x{0346}-\x{035f}\x{0362}-\x{0385}\x{038b}\x{038d}\x{03a2}\x{03cf}\x{03d7}-\x{03d9}\x{03db}\x{03dd}\x{03df}' .
  501. '\x{03e1}\x{03f4}-\x{0400}\x{040d}\x{0450}\x{045d}\x{0482}\x{0487}-\x{048f}\x{04c5}-\x{04c6}\x{04c9}-\x{04ca}' .
  502. '\x{04cd}-\x{04cf}\x{04ec}-\x{04ed}\x{04f6}-\x{04f7}\x{04fa}-\x{0530}\x{0557}-\x{0558}\x{055a}-\x{0560}' .
  503. '\x{0587}-\x{0590}\x{05a2}\x{05ba}\x{05be}\x{05c0}\x{05c3}\x{05c5}-\x{05cf}\x{05eb}-\x{05ef}\x{05f3}-\x{0620}' .
  504. '\x{063b}-\x{063f}\x{0653}-\x{065f}\x{066a}-\x{066f}\x{06b8}-\x{06b9}\x{06bf}\x{06cf}\x{06d4}\x{06e9}' .
  505. '\x{06ee}-\x{06ef}\x{06fa}-\x{0900}\x{0904}\x{093a}-\x{093b}\x{094e}-\x{0950}\x{0955}-\x{0957}' .
  506. '\x{0964}-\x{0965}\x{0970}-\x{0980}\x{0984}\x{098d}-\x{098e}\x{0991}-\x{0992}\x{09a9}\x{09b1}\x{09b3}-\x{09b5}' .
  507. '\x{09ba}-\x{09bb}\x{09bd}\x{09c5}-\x{09c6}\x{09c9}-\x{09ca}\x{09ce}-\x{09d6}\x{09d8}-\x{09db}\x{09de}' .
  508. '\x{09e4}-\x{09e5}\x{09f2}-\x{0a01}\x{0a03}-\x{0a04}\x{0a0b}-\x{0a0e}\x{0a11}-\x{0a12}\x{0a29}\x{0a31}\x{0a34}' .
  509. '\x{0a37}\x{0a3a}-\x{0a3b}\x{0a3d}\x{0a43}-\x{0a46}\x{0a49}-\x{0a4a}\x{0a4e}-\x{0a58}\x{0a5d}\x{0a5f}-\x{0a65}' .
  510. '\x{0a75}-\x{0a80}\x{0a84}\x{0a8c}\x{0a8e}\x{0a92}\x{0aa9}\x{0ab1}\x{0ab4}\x{0aba}-\x{0abb}\x{0ac6}\x{0aca}' .
  511. '\x{0ace}-\x{0adf}\x{0ae1}-\x{0ae5}\x{0af0}-\x{0b00}\x{0b04}\x{0b0d}-\x{0b0e}\x{0b11}-\x{0b12}\x{0b29}\x{0b31}' .
  512. '\x{0b34}-\x{0b35}\x{0b3a}-\x{0b3b}\x{0b44}-\x{0b46}\x{0b49}-\x{0b4a}\x{0b4e}-\x{0b55}\x{0b58}-\x{0b5b}\x{0b5e}' .
  513. '\x{0b62}-\x{0b65}\x{0b70}-\x{0b81}\x{0b84}\x{0b8b}-\x{0b8d}\x{0b91}\x{0b96}-\x{0b98}\x{0b9b}\x{0b9d}' .
  514. '\x{0ba0}-\x{0ba2}\x{0ba5}-\x{0ba7}\x{0bab}-\x{0bad}\x{0bb6}\x{0bba}-\x{0bbd}\x{0bc3}-\x{0bc5}\x{0bc9}' .
  515. '\x{0bce}-\x{0bd6}\x{0bd8}-\x{0be6}\x{0bf0}-\x{0c00}\x{0c04}\x{0c0d}\x{0c11}\x{0c29}\x{0c34}\x{0c3a}-\x{0c3d}' .
  516. '\x{0c45}\x{0c49}\x{0c4e}-\x{0c54}\x{0c57}-\x{0c5f}\x{0c62}-\x{0c65}\x{0c70}-\x{0c81}\x{0c84}\x{0c8d}\x{0c91}' .
  517. '\x{0ca9}\x{0cb4}\x{0cba}-\x{0cbd}\x{0cc5}\x{0cc9}\x{0cce}-\x{0cd4}\x{0cd7}-\x{0cdd}\x{0cdf}\x{0ce2}-\x{0ce5}' .
  518. '\x{0cf0}-\x{0d01}\x{0d04}\x{0d0d}\x{0d11}\x{0d29}\x{0d3a}-\x{0d3d}\x{0d44}-\x{0d45}\x{0d49}\x{0d4e}-\x{0d56}' .
  519. '\x{0d58}-\x{0d5f}\x{0d62}-\x{0d65}\x{0d70}-\x{0e00}\x{0e2f}\x{0e3b}-\x{0e3f}\x{0e4f}\x{0e5a}-\x{0e80}\x{0e83}' .
  520. '\x{0e85}-\x{0e86}\x{0e89}\x{0e8b}-\x{0e8c}\x{0e8e}-\x{0e93}\x{0e98}\x{0ea0}\x{0ea4}\x{0ea6}\x{0ea8}-\x{0ea9}' .
  521. '\x{0eac}\x{0eaf}\x{0eba}\x{0ebe}-\x{0ebf}\x{0ec5}\x{0ec7}\x{0ece}-\x{0ecf}\x{0eda}-\x{0f17}\x{0f1a}-\x{0f1f}' .
  522. '\x{0f2a}-\x{0f34}\x{0f36}\x{0f38}\x{0f3a}-\x{0f3d}\x{0f48}\x{0f6a}-\x{0f70}\x{0f85}\x{0f8c}-\x{0f8f}\x{0f96}' .
  523. '\x{0f98}\x{0fae}-\x{0fb0}\x{0fb8}\x{0fba}-\x{109f}\x{10c6}-\x{10cf}\x{10f7}-\x{10ff}\x{1101}\x{1104}\x{1108}' .
  524. '\x{110a}\x{110d}\x{1113}-\x{113b}\x{113d}\x{113f}\x{1141}-\x{114b}\x{114d}\x{114f}\x{1151}-\x{1153}' .
  525. '\x{1156}-\x{1158}\x{115a}-\x{115e}\x{1162}\x{1164}\x{1166}\x{1168}\x{116a}-\x{116c}\x{116f}-\x{1171}\x{1174}' .
  526. '\x{1176}-\x{119d}\x{119f}-\x{11a7}\x{11a9}-\x{11aa}\x{11ac}-\x{11ad}\x{11b0}-\x{11b6}\x{11b9}\x{11bb}' .
  527. '\x{11c3}-\x{11ea}\x{11ec}-\x{11ef}\x{11f1}-\x{11f8}\x{11fa}-\x{1dff}\x{1e9c}-\x{1e9f}\x{1efa}-\x{1eff}' .
  528. '\x{1f16}-\x{1f17}\x{1f1e}-\x{1f1f}\x{1f46}-\x{1f47}\x{1f4e}-\x{1f4f}\x{1f58}\x{1f5a}\x{1f5c}\x{1f5e}' .
  529. '\x{1f7e}-\x{1f7f}\x{1fb5}\x{1fbd}\x{1fbf}-\x{1fc1}\x{1fc5}\x{1fcd}-\x{1fcf}\x{1fd4}-\x{1fd5}\x{1fdc}-\x{1fdf}' .
  530. '\x{1fed}-\x{1ff1}\x{1ff5}\x{1ffd}-\x{20cf}\x{20dd}-\x{20e0}\x{20e2}-\x{2125}\x{2127}-\x{2129}' .
  531. '\x{212c}-\x{212d}\x{212f}-\x{217f}\x{2183}-\x{3004}\x{3006}\x{3008}-\x{3020}\x{3030}\x{3036}-\x{3040}' .
  532. '\x{3095}-\x{3098}\x{309b}-\x{309c}\x{309f}-\x{30a0}\x{30fb}\x{30ff}-\x{3104}\x{312d}-\x{4dff}' .
  533. '\x{9fa6}-\x{abff}\x{d7a4}-\x{d7ff}\x{e000}-\x{ffff}';
  534. }
  535. return false;
  536. }
  537. }