PluginProbe
Vimeography: Vimeo Video Gallery WordPress Plugin / 2.2
Vimeography: Vimeo Video Gallery WordPress Plugin v2.2
2.4.9 2.4.8 trunk 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.6 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.6.7 0.6.8 0.6.8.1 0.6.9 0.6.9.1 0.6.9.2 0.7 0.8 All 103 releases
vimeography / lib / filesystem.php

filesystem.php in Vimeography: Vimeo Video Gallery WordPress Plugin 2.2, at lib/filesystem.php

57 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) exit;
5
6 class Vimeography_Filesystem {
7
8 /**
9 * Set to ftp for testing
10 * @var string
11 */
12 protected $_method = '';
13
14 /**
15 * [$_url description]
16 * @var string
17 */
18 protected $_url = '';
19
20 /**
21 * [$_fields description]
22 * @var array
23 */
24 protected $_fields = array();
25
26 /**
27 * [__construct description]
28 * @param string $url [description]
29 * @param array $fields [description]
30 */
31 public function __construct( $url = '', $fields = array() ) {
32 $this->_url = $url;
33 $this->_fields = $fields;
34 }
35
36 /**
37 * [connect description]
38 * @return [type] [description]
39 */
40 public function connect() {
41 // Try to setup WP_Filesystem
42 if ( FALSE === ( $creds = request_filesystem_credentials( $this->_url, $this->_method, FALSE, FALSE, $this->_fields ) ) )
43 // A form has just been output asking the user to verify file ownership
44 return FALSE;
45
46 // If the user enters the credentials but the credentials can't be verified to setup WP_Filesystem, output the form again
47 if ( ! WP_Filesystem( $creds ) ) {
48 // This time produce the error that tells the user there was an error connecting
49 request_filesystem_credentials( $this->_url, $this->_method, TRUE, FALSE, $this->_fields );
50 return FALSE;
51 }
52
53 return TRUE;
54 }
55
56 }
57