Changed the use of import to uses.

This commit is contained in:
Juan Basso 2011-04-12 23:29:34 -04:00
parent 50c21ccdfe
commit 3c703641b0
4 changed files with 14 additions and 10 deletions

View file

@ -16,8 +16,9 @@
* @since CakePHP(tm) v 2.0.0 * @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', array('Validation', 'Multibyte')); App::uses('Validation', 'Utility');
App::import('Lib', 'email/AbstractTransport'); App::uses('Multibyte', 'I18n');
App::uses('AbstractTransport', 'Network/Email');
/** /**
* Cake e-mail class. * Cake e-mail class.
@ -813,8 +814,10 @@ class CakeEmail {
$this->_message[] = ''; $this->_message[] = '';
} }
$transportClassname = Inflector::camelize($this->_transportName) . 'Transport'; list($plugin, $transportClassname) = pluginSplit($this->_transportName, true);
if (!App::import('Lib', 'email/' . $transportClassname)) { $transportClassname .= 'Transport';
App::uses($transportClassname, $plugin . 'Network/Email');
if (!class_exists($transportClassname)) {
throw new SocketException(__('Class "%s" not found.', $transportClassname)); throw new SocketException(__('Class "%s" not found.', $transportClassname));
} elseif (!method_exists($transportClassname, 'send')) { } elseif (!method_exists($transportClassname, 'send')) {
throw new SocketException(__('The "%s" do not have send method.', $transportClassname)); throw new SocketException(__('The "%s" do not have send method.', $transportClassname));
@ -1030,9 +1033,9 @@ class CakeEmail {
$viewClass = $this->_viewRender; $viewClass = $this->_viewRender;
if ($viewClass !== 'View') { if ($viewClass !== 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass); list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass = $viewClass . 'View'; $viewClass .= 'View';
App::import('View', $this->_viewRender); App::uses($viewClass, $plugin . 'View');
} }
$View = new $viewClass(null); $View = new $viewClass(null);

View file

@ -16,7 +16,7 @@
* @since CakePHP(tm) v 2.0.0 * @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'CakeSocket'); App::uses('CakeSocket', 'Network');
/** /**
* SendEmail class * SendEmail class

View file

@ -16,7 +16,7 @@
* @since CakePHP(tm) v 2.0.0 * @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'CakeEmail'); App::uses('CakeEmail', 'Network');
/** /**
* Help to test CakeEmail * Help to test CakeEmail

View file

@ -16,7 +16,8 @@
* @since CakePHP(tm) v 2.0.0 * @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Lib', array('CakeEmail', 'email/AbstractTransport', 'email/SmtpTransport')); App::uses('CakeEmail', 'Network');
App::uses('SmtpTransport', 'Network/Email');
/** /**
* Help to test SmtpTransport * Help to test SmtpTransport