84 | | if ( ABSPATH == $dir && ! $wp_filesystem->abspath() ) |
85 | | return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); |
86 | | |
87 | | elseif ( WP_CONTENT_DIR == $dir && ! $wp_filesystem->wp_content_dir() ) |
88 | | return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); |
89 | | |
90 | | elseif ( WP_PLUGIN_DIR == $dir && ! $wp_filesystem->wp_plugins_dir() ) |
91 | | return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); |
92 | | |
93 | | elseif ( WP_CONTENT_DIR . '/themes' == $dir && ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') ) |
94 | | return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); |
95 | | |
96 | | elseif ( ! $wp_filesystem->find_folder($dir) ) |
97 | | return new WP_Error('fs_no_folder', sprintf($strings['fs_no_folder'], $dir)); |
| 84 | switch ( $dir ) { |
| 85 | case ABSPATH: |
| 86 | if ( ! $wp_filesystem->abspath() ) |
| 87 | return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']); |
| 88 | break; |
| 89 | case WP_CONTENT_DIR: |
| 90 | if ( ! $wp_filesystem->wp_content_dir() ) |
| 91 | return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']); |
| 92 | break; |
| 93 | case WP_PLUGIN_DIR: |
| 94 | if ( ! $wp_filesystem->wp_plugins_dir() ) |
| 95 | return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); |
| 96 | break; |
| 97 | case WP_CONTENT_DIR . '/themes': |
| 98 | if ( ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') ) |
| 99 | return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); |
| 100 | break; |
| 101 | default: |
| 102 | if ( ! $wp_filesystem->find_folder($dir) ) |
| 103 | return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir)); |
| 104 | break; |
| 105 | } |