Skip to content

Instantly share code, notes, and snippets.

@GDmac GDmac/EE_ftp.php forked from davist11/Ftp.php
Last active Dec 29, 2015

Embed
What would you like to do?
Call with $this->EE->load->library('my_ftp'); It will load CI_ftp and replace $this->EE->ftp with your ftp class
<?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;
}
}
<?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
You can’t perform that action at this time.