|
@@ -29,7 +29,7 @@ class xmlArray
|
|
|
|
|
|
|
|
|
|
* holds debugging level
|
|
* holds debugging level
|
|
- * @var type
|
|
+ * @var int
|
|
*/
|
|
*/
|
|
public $debug_level;
|
|
public $debug_level;
|
|
|
|
|
|
@@ -80,6 +80,7 @@ class xmlArray
|
|
* Get the root element's name.
|
|
* Get the root element's name.
|
|
* Example use:
|
|
* Example use:
|
|
* echo $element->name();
|
|
* echo $element->name();
|
|
|
|
+ * @return string The root element's name
|
|
*/
|
|
*/
|
|
public function name()
|
|
public function name()
|
|
{
|
|
{
|
|
@@ -94,6 +95,7 @@ class xmlArray
|
|
* $data = $xml->fetch('html/head/title');
|
|
* $data = $xml->fetch('html/head/title');
|
|
* @param string $path - the path to the element to fetch
|
|
* @param string $path - the path to the element to fetch
|
|
* @param bool $get_elements - whether to include elements
|
|
* @param bool $get_elements - whether to include elements
|
|
|
|
+ * @return string The value or attribute of the specified element
|
|
*/
|
|
*/
|
|
public function fetch($path, $get_elements = false)
|
|
public function fetch($path, $get_elements = false)
|
|
{
|
|
{
|
|
@@ -315,6 +317,7 @@ class xmlArray
|
|
* print_r($xml->to_array());
|
|
* print_r($xml->to_array());
|
|
*
|
|
*
|
|
* @param string $path the path to output.
|
|
* @param string $path the path to output.
|
|
|
|
+ * @return array An array of XML data
|
|
*/
|
|
*/
|
|
public function to_array($path = null)
|
|
public function to_array($path = null)
|
|
{
|
|
{
|
|
@@ -340,6 +343,7 @@ class xmlArray
|
|
* Parse data into an array. (privately used...)
|
|
* Parse data into an array. (privately used...)
|
|
*
|
|
*
|
|
* @param string $data to parse
|
|
* @param string $data to parse
|
|
|
|
+ * @return array The parsed array
|
|
*/
|
|
*/
|
|
protected function _parse($data)
|
|
protected function _parse($data)
|
|
{
|
|
{
|
|
@@ -487,8 +491,8 @@ class xmlArray
|
|
|
|
|
|
* Get a specific element's xml. (privately used...)
|
|
* Get a specific element's xml. (privately used...)
|
|
*
|
|
*
|
|
- * @param $array
|
|
+ * @param array $array An array of element data
|
|
- * @param $indent
|
|
+ * @param null|int $indent How many levels to indent the elements (null = no indent)
|
|
*/
|
|
*/
|
|
protected function _xml($array, $indent)
|
|
protected function _xml($array, $indent)
|
|
{
|
|
{
|
|
@@ -540,8 +544,8 @@ class xmlArray
|
|
|
|
|
|
* Return an element as an array
|
|
* Return an element as an array
|
|
*
|
|
*
|
|
- * @param type $array
|
|
+ * @param array $array
|
|
- * @return type
|
|
+ * @return string|array A string with the element's value or an array of element datas
|
|
*/
|
|
*/
|
|
protected function _array($array)
|
|
protected function _array($array)
|
|
{
|
|
{
|
|
@@ -567,7 +571,8 @@ class xmlArray
|
|
|
|
|
|
* Parse out CDATA tags. (htmlspecialchars them...)
|
|
* Parse out CDATA tags. (htmlspecialchars them...)
|
|
*
|
|
*
|
|
- * @param $data
|
|
+ * @param string $data The data with CDATA tags included
|
|
|
|
+ * @return string The data contained within CDATA tags
|
|
*/
|
|
*/
|
|
function _to_cdata($data)
|
|
function _to_cdata($data)
|
|
{
|
|
{
|
|
@@ -604,7 +609,8 @@ class xmlArray
|
|
|
|
|
|
* Turn the CDATAs back to normal text.
|
|
* Turn the CDATAs back to normal text.
|
|
*
|
|
*
|
|
- * @param $data
|
|
+ * @param string $data
|
|
|
|
+ * @return string The transformed data
|
|
*/
|
|
*/
|
|
protected function _from_cdata($data)
|
|
protected function _from_cdata($data)
|
|
{
|
|
{
|
|
@@ -621,6 +627,7 @@ class xmlArray
|
|
* Given an array, return the text from that array. (recursive and privately used.)
|
|
* Given an array, return the text from that array. (recursive and privately used.)
|
|
*
|
|
*
|
|
* @param array $array
|
|
* @param array $array
|
|
|
|
+ * @return string The text from the array
|
|
*/
|
|
*/
|
|
protected function _fetch($array)
|
|
protected function _fetch($array)
|
|
{
|
|
{
|
|
@@ -654,6 +661,7 @@ class xmlArray
|
|
* @param string $path
|
|
* @param string $path
|
|
* @param int $level
|
|
* @param int $level
|
|
* @param bool $no_error
|
|
* @param bool $no_error
|
|
|
|
+ * @return string|array The specified array (or the contents of said array if there's only one result)
|
|
*/
|
|
*/
|
|
protected function _path($array, $path, $level, $no_error = false)
|
|
protected function _path($array, $path, $level, $no_error = false)
|
|
{
|
|
{
|
|
@@ -725,29 +733,29 @@ class ftp_connection
|
|
|
|
|
|
|
|
|
|
* holds any errors
|
|
* holds any errors
|
|
- * @var type
|
|
+ * @var string
|
|
*/
|
|
*/
|
|
public $error;
|
|
public $error;
|
|
|
|
|
|
|
|
|
|
* holds last message from the server
|
|
* holds last message from the server
|
|
- * @var type
|
|
+ * @var string
|
|
*/
|
|
*/
|
|
public $last_message;
|
|
public $last_message;
|
|
|
|
|
|
|
|
|
|
* Passive connection
|
|
* Passive connection
|
|
- * @var type
|
|
+ * @var boolean
|
|
*/
|
|
*/
|
|
public $pasv;
|
|
public $pasv;
|
|
|
|
|
|
|
|
|
|
* Create a new FTP connection...
|
|
* Create a new FTP connection...
|
|
*
|
|
*
|
|
- * @param type $ftp_server
|
|
+ * @param string $ftp_server
|
|
- * @param type $ftp_port
|
|
+ * @param int $ftp_port
|
|
- * @param type $ftp_user
|
|
+ * @param string $ftp_user
|
|
- * @param type $ftp_pass
|
|
+ * @param string $ftp_pass
|
|
*/
|
|
*/
|
|
public function __construct($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = 'ftpclient@simplemachines.org')
|
|
public function __construct($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = 'ftpclient@simplemachines.org')
|
|
{
|
|
{
|
|
@@ -763,11 +771,10 @@ class ftp_connection
|
|
|
|
|
|
* Connects to a server
|
|
* Connects to a server
|
|
*
|
|
*
|
|
- * @param type $ftp_server
|
|
+ * @param string $ftp_server
|
|
- * @param type $ftp_port
|
|
+ * @param int $ftp_port
|
|
- * @param type $ftp_user
|
|
+ * @param string $ftp_user
|
|
- * @param type $ftp_pass
|
|
+ * @param string $ftp_pass
|
|
- * @return type
|
|
|
|
*/
|
|
*/
|
|
public function connect($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = 'ftpclient@simplemachines.org')
|
|
public function connect($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = 'ftpclient@simplemachines.org')
|
|
{
|
|
{
|
|
@@ -814,8 +821,8 @@ class ftp_connection
|
|
|
|
|
|
* Changes to a directory (chdir) via the ftp connection
|
|
* Changes to a directory (chdir) via the ftp connection
|
|
*
|
|
*
|
|
- * @param type $ftp_path
|
|
+ * @param string $ftp_path The path to the directory we want to change to
|
|
- * @return boolean
|
|
+ * @return boolean Whether or not the operation was successful
|
|
*/
|
|
*/
|
|
public function chdir($ftp_path)
|
|
public function chdir($ftp_path)
|
|
{
|
|
{
|
|
@@ -839,9 +846,9 @@ class ftp_connection
|
|
|
|
|
|
* Changes a files atrributes (chmod)
|
|
* Changes a files atrributes (chmod)
|
|
*
|
|
*
|
|
- * @param string $ftp_file
|
|
+ * @param string $ftp_file The file to CHMOD
|
|
- * @param type $chmod
|
|
+ * @param int|string $chmod The value for the CHMOD operation
|
|
- * @return boolean
|
|
+ * @return boolean Whether or not the operation was successful
|
|
*/
|
|
*/
|
|
public function chmod($ftp_file, $chmod)
|
|
public function chmod($ftp_file, $chmod)
|
|
{
|
|
{
|
|
@@ -865,8 +872,8 @@ class ftp_connection
|
|
|
|
|
|
* Deletes a file
|
|
* Deletes a file
|
|
*
|
|
*
|
|
- * @param type $ftp_file
|
|
+ * @param string $ftp_file The file to delete
|
|
- * @return boolean
|
|
+ * @return boolean Whether or not the operation was successful
|
|
*/
|
|
*/
|
|
public function unlink($ftp_file)
|
|
public function unlink($ftp_file)
|
|
{
|
|
{
|
|
@@ -894,8 +901,8 @@ class ftp_connection
|
|
|
|
|
|
* Reads the response to the command from the server
|
|
* Reads the response to the command from the server
|
|
*
|
|
*
|
|
- * @param type $desired
|
|
+ * @param string $desired The desired response
|
|
- * @return type
|
|
+ * @return boolean Whether or not we got the desired response
|
|
*/
|
|
*/
|
|
public function check_response($desired)
|
|
public function check_response($desired)
|
|
{
|
|
{
|
|
@@ -912,7 +919,7 @@ class ftp_connection
|
|
|
|
|
|
* Used to create a passive connection
|
|
* Used to create a passive connection
|
|
*
|
|
*
|
|
- * @return boolean
|
|
+ * @return boolean Whether the passive connection was created successfully
|
|
*/
|
|
*/
|
|
public function passive()
|
|
public function passive()
|
|
{
|
|
{
|
|
@@ -950,8 +957,8 @@ class ftp_connection
|
|
|
|
|
|
* Creates a new file on the server
|
|
* Creates a new file on the server
|
|
*
|
|
*
|
|
- * @param type $ftp_file
|
|
+ * @param string $ftp_file The file to create
|
|
- * @return boolean
|
|
+ * @return boolean Whether or not the file was created successfully
|
|
*/
|
|
*/
|
|
public function create_file($ftp_file)
|
|
public function create_file($ftp_file)
|
|
{
|
|
{
|
|
@@ -989,9 +996,9 @@ class ftp_connection
|
|
|
|
|
|
* Generates a direcotry listing for the current directory
|
|
* Generates a direcotry listing for the current directory
|
|
*
|
|
*
|
|
- * @param type $ftp_path
|
|
+ * @param string $ftp_path The path to the directory
|
|
- * @param type $search
|
|
+ * @param type $search Whether or not to get a recursive directory listing
|
|
- * @return boolean
|
|
+ * @return string|boolean The results of the command or false if unsuccessful
|
|
*/
|
|
*/
|
|
public function list_dir($ftp_path = '', $search = false)
|
|
public function list_dir($ftp_path = '', $search = false)
|
|
{
|
|
{
|
|
@@ -1034,8 +1041,8 @@ class ftp_connection
|
|
|
|
|
|
* Determins the current dirctory we are in
|
|
* Determins the current dirctory we are in
|
|
*
|
|
*
|
|
- * @param type $file
|
|
+ * @param string $file The name of a file
|
|
- * @param type $listing
|
|
+ * @param string $listing A directory listing or null to generate one
|
|
* @return string|boolean
|
|
* @return string|boolean
|
|
*/
|
|
*/
|
|
public function locate($file, $listing = null)
|
|
public function locate($file, $listing = null)
|
|
@@ -1081,8 +1088,8 @@ class ftp_connection
|
|
|
|
|
|
* Creates a new directory on the server
|
|
* Creates a new directory on the server
|
|
*
|
|
*
|
|
- * @param type $ftp_dir
|
|
+ * @param string $ftp_dir The name of the directory to create
|
|
- * @return boolean
|
|
+ * @return boolean Whether or not the operation was successful
|
|
*/
|
|
*/
|
|
public function create_dir($ftp_dir)
|
|
public function create_dir($ftp_dir)
|
|
{
|
|
{
|
|
@@ -1104,9 +1111,9 @@ class ftp_connection
|
|
|
|
|
|
* Detects the current path
|
|
* Detects the current path
|
|
*
|
|
*
|
|
- * @param type $filesystem_path
|
|
+ * @param string $filesystem_path The full path from the filesystem
|
|
- * @param type $lookup_file
|
|
+ * @param string $lookup_file The name of a file in the specified path
|
|
- * @return type
|
|
+ * @return array An array of detected info - username, path from FTP root and whether or not the current path was found
|
|
*/
|
|
*/
|
|
public function detect_path($filesystem_path, $lookup_file = null)
|
|
public function detect_path($filesystem_path, $lookup_file = null)
|
|
{
|
|
{
|
|
@@ -1156,7 +1163,7 @@ class ftp_connection
|
|
|
|
|
|
* Close the ftp connection
|
|
* Close the ftp connection
|
|
*
|
|
*
|
|
- * @return boolean
|
|
+ * @return boolean Always returns true
|
|
*/
|
|
*/
|
|
public function close()
|
|
public function close()
|
|
{
|
|
{
|