public function test_verify_filepath_and_permissions()
 {
     global $wp_filesystem;
     // Test creation/exists checks
     $this->assertFalse($wp_filesystem->is_dir('/test/'));
     $wp_filesystem->mkdir('/test', '755');
     $this->assertTrue($wp_filesystem->is_dir('/test/'));
     $this->assertTrue(EEH_File::verify_filepath_and_permissions('/test/'));
     $wp_filesystem->chmod('/test/', '000');
     try {
         EEH_File::verify_filepath_and_permissions('/test/');
         $this->fail(sprintf(__('An exception SHOULD have been thrown but wasn\'t', 'event_espresso')));
     } catch (EE_Error $e) {
         $this->assertTrue(TRUE);
     }
 }
Ejemplo n.º 2
0
 /**
  * get_file_contents
  * @param string $full_file_path
  * @return string
  */
 public static function get_file_contents($full_file_path = '')
 {
     $full_file_path = EEH_File::standardise_directory_separators($full_file_path);
     if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
         // load WP_Filesystem and set file permissions
         $wp_filesystem = EEH_File::_get_wp_filesystem();
         return $wp_filesystem->get_contents($full_file_path);
     }
     return '';
 }