mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-11 15:16:55 +03:00
support mukadi/wordpress-bundle v2.0
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
mukadi_wordpress:
|
||||
table_prefix: "%env(WP_PREFIX)%"
|
||||
wordpress_directory: '%kernel.project_dir%/public/%env(WP_DIR)%'
|
||||
@@ -1,10 +0,0 @@
|
||||
# BEGIN WordPress
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
</IfModule>
|
||||
# END WordPress
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Symfony Bridge
|
||||
Plugin URI: http://www.geniusconception.com/
|
||||
Description: For use symfony service in wordpress, and spread event trought symfony from wp.
|
||||
Version: 0.0.1
|
||||
Author: Olivier M. Mukadi
|
||||
Author URI: http://www.geniusconception.net/
|
||||
*/
|
||||
/**
|
||||
* retreive symfony service
|
||||
*/
|
||||
function symfony ($id){
|
||||
global $sf;
|
||||
return $sf($id);
|
||||
}
|
||||
|
||||
function symfony_container_ready(){
|
||||
return isset($GLOBALS['sf']);
|
||||
}
|
||||
/**
|
||||
* dispatch event in symfony
|
||||
*/
|
||||
function symfony_dispatch($name, \Mukadi\WordpressBundle\Event\WordpressEvent $event)
|
||||
{
|
||||
if (!symfony_container_ready()) return;
|
||||
return symfony('event_dispatcher')->dispatch($name, $event);
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php
|
||||
# nothing here
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
// Set theme defaults.
|
||||
add_action('after_setup_theme', function () {
|
||||
|
||||
// Add post thumbnails support.
|
||||
add_theme_support('post-thumbnails');
|
||||
|
||||
// Add title tag theme support.
|
||||
add_theme_support('title-tag');
|
||||
|
||||
// Add HTML5 support.
|
||||
add_theme_support('html5', [
|
||||
'caption',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'search-form',
|
||||
'widgets',
|
||||
]);
|
||||
|
||||
register_nav_menu('main', __('Menu Principal','the_theme'));
|
||||
});
|
||||
|
||||
// Enqueue and register scripts the right way.
|
||||
add_action('wp_enqueue_scripts', function () {
|
||||
wp_enqueue_style( 'the_theme-style', get_stylesheet_uri(), array());
|
||||
});
|
||||
|
||||
// Remove JPEG compression.
|
||||
add_filter('jpeg_quality', function () {
|
||||
return 100;
|
||||
}, 10, 2);
|
||||
|
||||
// Set custom excerpt more.
|
||||
add_filter('excerpt_more', function () {
|
||||
return '...';
|
||||
});
|
||||
|
||||
// Set custom excerpt length.
|
||||
add_filter('excerpt_length', function () {
|
||||
return 101;
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
|
||||
<header>
|
||||
<nav role="navigation">
|
||||
<?php wp_nav_menu(['theme_location' => 'main']); ?>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
<main role="main">
|
||||
<?php if (have_posts()): while (have_posts()): the_post(); ?>
|
||||
<article>
|
||||
<header>
|
||||
<h1><?php the_title(); ?></h1>
|
||||
</header>
|
||||
|
||||
<?php the_content(); ?>
|
||||
</article>
|
||||
<?php endwhile; else: ?>
|
||||
<article>
|
||||
<p>Nothing to see.</p>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php get_footer();
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
Theme Name: WPBlank
|
||||
Author: Olivier M. Mukadi
|
||||
Author URI: www.consiidrc.net
|
||||
Version: 0.1.0
|
||||
Description: Default theme, feel free to make or install your own.
|
||||
*/
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
$config = new \Mukadi\WordpressBundle\Config(
|
||||
realpath(__DIR__)
|
||||
);
|
||||
|
||||
// define('WP_ALLOW_MULTISITE', env('WP_ALLOW_MULTISITE', true));
|
||||
|
||||
$table_prefix = env('WP_PREFIX', 'wp_');
|
||||
|
||||
/* That's all, stop editing! Happy blogging. */
|
||||
$config->apply();
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Component\Debug\Debug;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
function run(){
|
||||
// The check is to ensure we don't use .env in production
|
||||
if (!isset($_SERVER['APP_ENV'])) {
|
||||
if (!class_exists(Dotenv::class)) {
|
||||
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
|
||||
}
|
||||
(new Dotenv())->load(__DIR__.'/../.env');
|
||||
}
|
||||
$env = $_SERVER['APP_ENV'] ?? 'dev';
|
||||
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
|
||||
if ($debug) {
|
||||
umask(0000);
|
||||
Debug::enable();
|
||||
}
|
||||
define('WP_DEBUG', $debug);
|
||||
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
|
||||
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
||||
}
|
||||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
|
||||
Request::setTrustedHosts(explode(',', $trustedHosts));
|
||||
}
|
||||
$kernel = new Kernel($env, $debug);
|
||||
# SF container in WP
|
||||
$GLOBALS['sf'] = function ($id) use (&$kernel) {
|
||||
return $kernel->getContainer()->get($id);
|
||||
};
|
||||
$kernelRequest = Request::createFromGlobals();
|
||||
$kernelResponse = $kernel->handle($kernelRequest);
|
||||
$kernelResponse->send();
|
||||
$kernel->terminate($kernelRequest, $kernelResponse);
|
||||
}
|
||||
run();
|
||||
+4
-6
@@ -2,13 +2,11 @@
|
||||
"bundles": {
|
||||
"Mukadi\\WordpressBundle\\MukadiWordpressBundle": ["all"]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"public/": "%PUBLIC_DIR%",
|
||||
"sf-wp-bootstrap.php": "sf-wp-bootstrap.php"
|
||||
},
|
||||
"copy-from-package": {
|
||||
"wp-cli.yml": "wp-cli.yml"
|
||||
"res/wp-cli.yml": "wp-cli.yml",
|
||||
"res/config/": "%CONFIG_DIR%/",
|
||||
"res/public/": "%PUBLIC_DIR%",
|
||||
"res/sf-wp-bootstrap.php": "sf-wp-bootstrap.php"
|
||||
},
|
||||
"env": {
|
||||
"WP_PREFIX": "wp_",
|
||||
Reference in New Issue
Block a user