; require_once (ABSPATH . '/wp-admin/includes/file.php'); WP_Filesystem(); global $wp_filesystem; $this->wp_filesystem = $wp_filesystem; $uploads = wp_upload_dir(); // Theme folders in `uploads` directory. $folders_in_uploads = array( 'base' => 'blocksy', 'css' => 'blocksy/css' ); $theme_paths = []; foreach($folders_in_uploads as $folder => $path) { // Server path. $theme_paths[ $folder . '_path' ] = $uploads['basedir'] . '/' . $path; // URL. $theme_paths[ $folder . '_url' ] = $uploads['baseurl'] . '/' . $path; } // Custom css file. if (! $this->has_direct_access($theme_paths['css_path'])) { return false; } if (null === $this->wp_filesystem) { return false; } if ($args['should_generate']) { foreach(array_keys($folders_in_uploads) as $folder) { $path = $theme_paths[$folder . '_path']; $parent = dirname($path); if ($this->wp_filesystem->is_writable($parent)) { if (! $this->wp_filesystem->is_dir($path)) { $this->wp_filesystem->mkdir($path); } } } } return $theme_paths; } public function has_direct_access($context = null) { require_once ABSPATH . 'wp-admin/includes/file.php'; WP_Filesystem(); /** @var WP_Filesystem_Base $wp_filesystem */ global $wp_filesystem; if ($wp_filesystem) { if ($wp_filesystem->method !== 'direct') { return false; } else { return true; } } if (get_filesystem_method([], $context) === 'direct') { ob_start(); $creds = request_filesystem_credentials( admin_url(), '', false, $context, null ); ob_end_clean(); if (WP_Filesystem($creds)) { return true; } } return false; } public function get_wp_filesystem() { return $this->wp_filesystem; } }
Fatal error: Uncaught Error: Class "Blocksy\DynamicCss" not found in /htdocs/wp-content/plugins/blocksy-companion/plugin.php:159 Stack trace: #0 /htdocs/wp-content/plugins/blocksy-companion/plugin.php(212): Blocksy\Plugin->early_init_with_blocksy_theme() #1 /htdocs/wp-content/plugins/blocksy-companion/plugin.php(56): Blocksy\Plugin->__construct() #2 /htdocs/wp-content/plugins/blocksy-companion/plugin.php(436): Blocksy\Plugin::instance() #3 /htdocs/wp-content/plugins/blocksy-companion/blocksy-companion.php(101): require('/htdocs/wp-cont...') #4 /htdocs/wp-settings.php(545): include_once('/htdocs/wp-cont...') #5 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-content/plugins/blocksy-companion/plugin.php on line 159