@@ -42,35 +42,35 @@ class CI_FTP {
4242 *
4343 * @var string
4444 */
45- public $ hostname = '' ;
45+ public $ hostname = '' ;
4646
4747 /**
4848 * FTP Username
4949 *
5050 * @var string
5151 */
52- public $ username = '' ;
52+ public $ username = '' ;
5353
5454 /**
5555 * FTP Password
5656 *
5757 * @var string
5858 */
59- public $ password = '' ;
59+ public $ password = '' ;
6060
6161 /**
6262 * FTP Server port
6363 *
6464 * @var int
6565 */
66- public $ port = 21 ;
66+ public $ port = 21 ;
6767
6868 /**
6969 * Passive mode flag
7070 *
7171 * @var bool
7272 */
73- public $ passive = TRUE ;
73+ public $ passive = TRUE ;
7474
7575 /**
7676 * Debug flag
@@ -79,14 +79,16 @@ class CI_FTP {
7979 *
8080 * @var bool
8181 */
82- public $ debug = FALSE ;
82+ public $ debug = FALSE ;
83+
84+ // --------------------------------------------------------------------
8385
8486 /**
85- * Connection
87+ * Connection ID
8688 *
8789 * @var resource
8890 */
89- public $ conn_id = FALSE ;
91+ protected $ conn_id ;
9092
9193 // --------------------------------------------------------------------
9294
@@ -98,11 +100,7 @@ class CI_FTP {
98100 */
99101 public function __construct ($ config = array ())
100102 {
101- if (count ($ config ) > 0 )
102- {
103- $ this ->initialize ($ config );
104- }
105-
103+ empty ($ config ) OR $ this ->initialize ($ config );
106104 log_message ('debug ' , 'FTP Class Initialized ' );
107105 }
108106
@@ -197,8 +195,10 @@ protected function _is_conn()
197195 {
198196 $ this ->_error ('ftp_no_connection ' );
199197 }
198+
200199 return FALSE ;
201200 }
201+
202202 return TRUE ;
203203 }
204204
@@ -232,6 +232,7 @@ public function changedir($path, $suppress_debug = FALSE)
232232 {
233233 $ this ->_error ('ftp_unable_to_changedir ' );
234234 }
235+
235236 return FALSE ;
236237 }
237238
@@ -262,6 +263,7 @@ public function mkdir($path, $permissions = NULL)
262263 {
263264 $ this ->_error ('ftp_unable_to_mkdir ' );
264265 }
266+
265267 return FALSE ;
266268 }
267269
@@ -316,6 +318,7 @@ public function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL)
316318 {
317319 $ this ->_error ('ftp_unable_to_upload ' );
318320 }
321+
319322 return FALSE ;
320323 }
321324
@@ -363,6 +366,7 @@ public function download($rempath, $locpath, $mode = 'auto')
363366 {
364367 $ this ->_error ('ftp_unable_to_download ' );
365368 }
369+
366370 return FALSE ;
367371 }
368372
@@ -394,6 +398,7 @@ public function rename($old_file, $new_file, $move = FALSE)
394398 {
395399 $ this ->_error ('ftp_unable_to_ ' .($ move === FALSE ? 'rename ' : 'move ' ));
396400 }
401+
397402 return FALSE ;
398403 }
399404
@@ -437,6 +442,7 @@ public function delete_file($filepath)
437442 {
438443 $ this ->_error ('ftp_unable_to_delete ' );
439444 }
445+
440446 return FALSE ;
441447 }
442448
@@ -596,12 +602,9 @@ public function mirror($locpath, $rempath)
596602 */
597603 protected function _getext ($ filename )
598604 {
599- if (($ dot = strrpos ($ filename , '. ' )) === FALSE )
600- {
601- return 'txt ' ;
602- }
603-
604- return substr ($ filename , $ dot + 1 );
605+ return (($ dot = strrpos ($ filename , '. ' )) === FALSE )
606+ ? 'txt '
607+ : substr ($ filename , $ dot + 1 );
605608 }
606609
607610 // --------------------------------------------------------------------
@@ -614,23 +617,9 @@ protected function _getext($filename)
614617 */
615618 protected function _settype ($ ext )
616619 {
617- $ text_types = array (
618- 'txt ' ,
619- 'text ' ,
620- 'php ' ,
621- 'phps ' ,
622- 'php4 ' ,
623- 'js ' ,
624- 'css ' ,
625- 'htm ' ,
626- 'html ' ,
627- 'phtml ' ,
628- 'shtml ' ,
629- 'log ' ,
630- 'xml '
631- );
632-
633- return in_array ($ ext , $ text_types ) ? 'ascii ' : 'binary ' ;
620+ return in_array ($ ext , array ('txt ' , 'text ' , 'php ' , 'phps ' , 'php4 ' , 'js ' , 'css ' , 'htm ' , 'html ' , 'phtml ' , 'shtml ' , 'log ' , 'xml ' ), TRUE )
621+ ? 'ascii '
622+ : 'binary ' ;
634623 }
635624
636625 // ------------------------------------------------------------------------
0 commit comments