Call with $this->EE->load->library('my_ftp'); It will load CI_ftp and replace $this->EE->ftp with your ftp class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
require_once(BASEPATH . 'libraries/Ftp.php'); | |
class EE_FTP extends CI_FTP { | |
var $timeout = 90; | |
/** | |
* FTP Connect | |
* | |
* @access public | |
* @param array the connection values | |
* @return bool | |
*/ | |
function connect($config = array()) | |
{ | |
if (count($config) > 0) | |
{ | |
$this->initialize($config); | |
} | |
echo 'hello'; | |
exit(); | |
if (FALSE === ($this->conn_id = @ftp_connect($this->hostname, $this->port, $this->timeout))) | |
{ | |
if ($this->debug == TRUE) | |
{ | |
$this->_error('ftp_unable_to_connect'); | |
} | |
return FALSE; | |
} | |
if ( ! $this->_login()) | |
{ | |
if ($this->debug == TRUE) | |
{ | |
$this->_error('ftp_unable_to_login'); | |
} | |
return FALSE; | |
} | |
// Set passive mode if needed | |
if ($this->passive == TRUE) | |
{ | |
ftp_pasv($this->conn_id, TRUE); | |
} | |
return TRUE; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
// # ==================================== | |
// # Load ftp and overload the property | |
class MY_FTP { | |
public $CI_ftp = null; | |
public $MY_ftp = null; | |
public function __construct($config = array()) | |
{ | |
$this->EE =& get_instance(); | |
if ($this->MY_ftp === null) | |
{ | |
// load both libraries | |
$this->EE->load->library('ftp'); | |
$this->EE->load->library('EE_ftp'); | |
// shuffle some variable | |
$this->CI_ftp = $this->EE->ftp; // keep a copy | |
$this->MY_ftp = new EE_FTP($config); | |
$this->EE->ftp = $this->MY_ftp; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment