PHP code example of vinkla / wordplate

1. Go to this page and download the library: Download vinkla/wordplate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vinkla / wordplate example snippets


     



namespace Valet\Drivers\Custom;

use Valet\Drivers\BasicValetDriver;

class WordPlateValetDriver extends BasicValetDriver
{
    public function serves(string $sitePath, string $siteName, string $uri): bool
    {
        return is_dir($sitePath . '/public/wordpress');
    }

    public function isStaticFile(string $sitePath, string $siteName, string $url)
    {
        $staticFilePath = $sitePath . '/public' . $url;

        if ($this->isActualFile($staticFilePath)) {
            return $staticFilePath;
        }

        return false;
    }

    public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
    {
        return parent::frontControllerPath(
            $sitePath . '/public',
            $siteName,
            $this->forceTrailingSlash($uri)
        );
    }

    private function forceTrailingSlash(string $uri)
    {
        if (substr($uri, -1 * strlen('/wordpress/wp-admin')) === '/wordpress/wp-admin') {
            header('Location: ' . $uri . '/');
            exit;
        }

        return $uri;
    }
}



final class WordPlateTinkerwellDriver extends WordpressTinkerwellDriver
{
    public function canBootstrap($projectPath)
    {
        return file_exists($projectPath . '/public/wordpress/wp-load.php');
    }

    public function bootstrap($projectPath)
    {
        

   $application->setPublicPath(realpath(__DIR__));
   
json
"installer-paths": {
    "public/mu-plugins/{$name}": [
        "type:wordpress-muplugin",
        "wpackagist-plugin/clean-image-filenames",
    ]
}
diff
    -mu-plugins/
    +mu-plugins/*
    +!mu-plugins/mu-plugins.php