Created
April 26, 2016 20:34
-
-
Save mstyne/ff31952bb6751f1d95454ef2c907a075 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* @param string $url | |
*/ | |
protected static function getFileSystem( $url = '' ) { | |
if ( empty( $url ) ) { | |
$url = wp_nonce_url( 'admin.php?page=vc-general', 'wpb_js_settings_save_action' ); | |
} | |
if ( false === ( $creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) { | |
_e( 'This is required to enable file writing for js_composer', 'js_composer' ); | |
exit(); // stop processing here | |
} | |
$upload_dir = wp_upload_dir(); | |
if ( ! WP_Filesystem( $creds, $upload_dir['basedir'] ) ) { | |
request_filesystem_credentials( $url, '', true, false, null ); | |
_e( 'This is required to enable file writing for js_composer', 'js_composer' ); | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment