Mark Scherer 10 年 前
コミット
e851ee107a

+ 2 - 1
Console/Command/IndentShell.php

@@ -12,6 +12,7 @@ if (!defined('CR')) {
 }
 App::uses('Folder', 'Utility');
 App::uses('AppShell', 'Console/Command');
+App::uses('CakeText', 'Utility);
 
 /**
  * Indent Shell
@@ -58,7 +59,7 @@ class IndentShell extends AppShell {
 	 */
 	public function folder() {
 		if (!empty($this->params['extensions'])) {
-			$this->settings['files'] = String::tokenize($this->params['extensions']);
+			$this->settings['files'] = CakeText::tokenize($this->params['extensions']);
 		}
 		if (!empty($this->params['again'])) {
 			$this->settings['againWithHalf'] = true;

+ 3 - 2
Controller/Component/CommonComponent.php

@@ -7,6 +7,7 @@ App::uses('Component', 'Controller');
 App::uses('Sanitize', 'Utility');
 App::uses('Utility', 'Tools.Utility');
 App::uses('Hash', 'Utility');
+App::uses('CakeText', 'Utility);
 
 /**
  * A component included in every app to take care of common stuff.
@@ -741,7 +742,7 @@ class CommonComponent extends Component {
 	/**
 	 * Takes list of items and transforms it into an array
 	 * + cleaning (trim, no empty parts, etc).
-	 * Similar to String::tokenize, but with more logic.
+	 * Similar to CakeText::tokenize, but with more logic.
 	 *
 	 * //TODO: 3.4. parameter as array, move to Lib
 	 *
@@ -757,7 +758,7 @@ class CommonComponent extends Component {
 		}
 
 		// parses the list, but leaves tokens untouched inside () brackets
-		$stringArray = String::tokenize($string, $separator);
+		$stringArray = CakeText::tokenize($string, $separator);
 		$returnArray = [];
 
 		if (empty($stringArray)) {

+ 3 - 2
Lib/EmailLib.php

@@ -3,6 +3,7 @@ App::uses('CakeEmail', 'Network/Email');
 App::uses('CakeLog', 'Log');
 App::uses('Utility', 'Tools.Utility');
 App::uses('MimeLib', 'Tools.Lib');
+App::uses('CakeText', 'Utility);
 
 // Support BC (snake case config)
 if (!Configure::read('Config.systemEmail')) {
@@ -162,7 +163,7 @@ class EmailLib extends CakeEmail {
 		if (empty($options['mimetype'])) {
 			$options['mimetype'] = $this->_getMime($file);
 		}
-		$options['contentId'] = $contentId ? $contentId : str_replace('-', '', String::uuid()) . '@' . $this->_domain;
+		$options['contentId'] = $contentId ? $contentId : str_replace('-', '', CakeText::uuid()) . '@' . $this->_domain;
 		$file = [$name => $options];
 		$res = $this->addAttachments($file);
 		if ($contentId === null) {
@@ -191,7 +192,7 @@ class EmailLib extends CakeEmail {
 		}
 		$options['content'] = $content;
 		$options['mimetype'] = $mimeType;
-		$options['contentId'] = $contentId ? $contentId : str_replace('-', '', String::uuid()) . '@' . $this->_domain;
+		$options['contentId'] = $contentId ? $contentId : str_replace('-', '', CakeText::uuid()) . '@' . $this->_domain;
 		$file = [$filename => $options];
 		$res = $this->addAttachments($file);
 		if ($contentId === null) {

+ 2 - 2
Lib/GeocodeLib.php

@@ -1,5 +1,5 @@
 <?php
-App::uses('String', 'Utility');
+App::uses('CakeText', 'Utility');
 App::uses('HttpSocket', 'Network/Http');
 
 /**
@@ -193,7 +193,7 @@ class GeocodeLib {
 		$params = [
 			'host' => $this->options['host']
 		];
-		$url = String::insert(static::BASE_URL, $params, ['before' => '{', 'after' => '}', 'clean' => true]);
+		$url = CakeText::insert(static::BASE_URL, $params, ['before' => '{', 'after' => '}', 'clean' => true]);
 		return $url;
 	}
 

+ 2 - 2
Lib/Utility/TextLib.php

@@ -1,12 +1,12 @@
 <?php
-App::uses('String', 'Utility');
+App::uses('CakeText', 'Utility');
 
 /**
  * Extend String.
  * //TODO: cleanup
  *
  */
-class TextLib extends String {
+class TextLib extends CakeText {
 
 	public $text, $length, $char, $letter, $space, $word, $rWord, $sen, $rSen, $para, $rPara, $beautified;
 

+ 4 - 4
Model/Behavior/JsonableBehavior.php

@@ -10,7 +10,7 @@
  */
 App::uses('ModelBehavior', 'Model');
 App::uses('Hash', 'Utility');
-App::uses('String', 'Utility');
+App::uses('CakeText', 'Utility');
 
 /**
  * A behavior that will json_encode (and json_decode) fields if they contain an array or specific pattern.
@@ -235,9 +235,9 @@ class JsonableBehavior extends ModelBehavior {
 		$separator = $this->settings[$Model->alias]['separator'];
 
 		$res = [];
-		$pieces = String::tokenize($val, $separator, $leftBound, $rightBound);
+		$pieces = CakeText::tokenize($val, $separator, $leftBound, $rightBound);
 		foreach ($pieces as $piece) {
-			$subpieces = String::tokenize($piece, $this->settings[$Model->alias]['keyValueSeparator'], $leftBound, $rightBound);
+			$subpieces = CakeText::tokenize($piece, $this->settings[$Model->alias]['keyValueSeparator'], $leftBound, $rightBound);
 			if (count($subpieces) < 2) {
 				continue;
 			}
@@ -256,7 +256,7 @@ class JsonableBehavior extends ModelBehavior {
 	public function _fromList(Model $Model, $val) {
 		extract($this->settings[$Model->alias]);
 
-		return String::tokenize($val, $separator, $leftBound, $rightBound);
+		return CakeText::tokenize($val, $separator, $leftBound, $rightBound);
 	}
 
 	/**

+ 2 - 2
Test/Case/View/Helper/IcalHelperTest.php

@@ -2,7 +2,7 @@
 
 App::uses('IcalHelper', 'Tools.View/Helper');
 App::uses('MyCakeTestCase', 'Tools.TestSuite');
-App::uses('String', 'Utility');
+App::uses('CakeText', 'Utility');
 App::uses('View', 'View');
 
 /**
@@ -55,7 +55,7 @@ class IcalHelperTest extends MyCakeTestCase {
 			'organizer' => 'CEO',
 			'class' => 'public',
 			'timestamp' => '2010-10-08 22:23:34',
-			'id' => String::uuid(),
+			'id' => CakeText::uuid(),
 			'location' => 'München'
 		];
 		$this->Ical->add($data);