Commit 36b34273 authored by Česlav Przywara's avatar Česlav Przywara

Bezirksblätter version 2.1.0-dev

parents
DB_NAME=database_name
DB_USER=database_user
DB_PASSWORD=database_password
# Optional variables
# DB_HOST=localhost
# DB_PREFIX=wp_
WP_ENV=development
WP_HOME=http://example.com
WP_SITEURL=${WP_HOME}/wp
# Generate your keys here: https://roots.io/salts.html
AUTH_KEY='generateme'
SECURE_AUTH_KEY='generateme'
LOGGED_IN_KEY='generateme'
NONCE_KEY='generateme'
AUTH_SALT='generateme'
SECURE_AUTH_SALT='generateme'
LOGGED_IN_SALT='generateme'
NONCE_SALT='generateme'
\ No newline at end of file
# Application
web/app/cache
web/app/plugins/*
!web/app/plugins/.gitkeep
web/app/mu-plugins/*/
web/app/upgrade
web/app/uploads/*
!web/app/uploads/.gitkeep
# WordPress
web/wp
web/.htaccess
# Dotenv
.env
.env.*
# Composer
vendor/*
!vendor/.gitkeep
Copyright (c) Roots
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Bezirksblätter
Repository for https://bezirksblaetter.cz website.
## Requirements
* [PHP](https://secure.php.net/) 7.0 or newer
* [Sass](http://www.sass-lang.com/) 3.4.21 or newer
{
"type": "project",
"description": "",
"homepage": "https://bezirksblaetter.cz",
"authors": [
{
"name": "Česlav Przywara",
"email": "ceslav@przywara.cz",
"homepage": "https://github.com/chesio"
}
],
"keywords": [
"wordpress", "bezirksblaetter"
],
"config": {
"preferred-install": "dist"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "composer",
"url": "https://packagist.chesio.com"
},
{
"type": "vcs",
"url": "https://github.com/chesio/cachify"
}
],
"require": {
"php": ">=5.6",
"composer/installers": "~1.2.0",
"vlucas/phpdotenv": "^2.0.1",
"johnpbloch/wordpress": "4.7.5",
"oscarotero/env": "^1.0",
"roots/wp-password-bcrypt": "1.0.0",
"roots/soil": "3.7.1",
"wpackagist-plugin/tinymce-advanced": "^4.5",
"wpackagist-plugin/enable-media-replace": "^3.0",
"wpackagist-plugin/disable-json-api": "^1.3",
"pluginkollektiv/cachify": "dev-composer",
"polylang/polylang-pro": "^2.1.5"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5.1"
},
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "web/wp"
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-install-cmd": [
"web/app/themes/bezirksblaetter/assets/build.sh"
],
"post-update-cmd": [
"web/app/themes/bezirksblaetter/assets/build.sh"
],
"test": [
"vendor/bin/phpcs"
]
}
}
This diff is collapsed.
<?php
/** @var string Directory containing all of the site's files */
$root_dir = dirname(__DIR__);
/** @var string Document Root */
$webroot_dir = $root_dir . '/web';
/**
* Expose global env() function from oscarotero/env
*/
Env::init();
/**
* Use Dotenv to set required environment variables and load .env file in root
*/
$dotenv = new Dotenv\Dotenv($root_dir);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL']);
}
/**
* Set up our global environment constant and load its config first
* Default: production
*/
define('WP_ENV', env('WP_ENV') ?: 'production');
$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';
if (file_exists($env_config)) {
require_once $env_config;
}
/**
* URLs
*/
define('WP_HOME', env('WP_HOME'));
define('WP_SITEURL', env('WP_SITEURL'));
/**
* Custom Content Directory
*/
define('CONTENT_DIR', '/app');
define('WP_CONTENT_DIR', $webroot_dir . CONTENT_DIR);
define('WP_CONTENT_URL', WP_HOME . CONTENT_DIR);
/**
* DB settings
*/
define('DB_NAME', env('DB_NAME'));
define('DB_USER', env('DB_USER'));
define('DB_PASSWORD', env('DB_PASSWORD'));
define('DB_HOST', env('DB_HOST') ?: 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
$table_prefix = env('DB_PREFIX') ?: 'wp_';
/**
* Authentication Unique Keys and Salts
*/
define('AUTH_KEY', env('AUTH_KEY'));
define('SECURE_AUTH_KEY', env('SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY', env('LOGGED_IN_KEY'));
define('NONCE_KEY', env('NONCE_KEY'));
define('AUTH_SALT', env('AUTH_SALT'));
define('SECURE_AUTH_SALT', env('SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', env('LOGGED_IN_SALT'));
define('NONCE_SALT', env('NONCE_SALT'));
/**
* Custom Settings
*/
define('AUTOMATIC_UPDATER_DISABLED', true);
define('DISABLE_WP_CRON', env('DISABLE_WP_CRON') ?: false);
define('DISALLOW_FILE_EDIT', true);
define('WP_MEMORY_LIMIT', '128M');
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
/**
* Bootstrap WordPress
*/
if (!defined('ABSPATH')) {
define('ABSPATH', $webroot_dir . '/wp/');
}
<?php
/**
* Development
*/
define('SAVEQUERIES', true);
define('SCRIPT_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_POST_REVISIONS', false);
<?php
/**
* Production
*/
define('SAVEQUERIES', false);
define('SCRIPT_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
define('WP_POST_REVISIONS', 10);
/** Disable all file modifications including updates and update notifications */
define('DISALLOW_FILE_MODS', true);
<?php
/**
* Plugin Name: Bedrock Autoloader
* Plugin URI: https://github.com/roots/bedrock/
* Description: An autoloader that enables standard plugins to be required just like must-use plugins. The autoloaded plugins are included during mu-plugin loading. An asterisk (*) next to the name of the plugin designates the plugins that have been autoloaded.
* Version: 1.0.0
* Author: Roots
* Author URI: https://roots.io/
* License: MIT License
*/
namespace Roots\Bedrock;
if (!is_blog_installed()) {
return;
}
/**
* Class Autoloader
* @package Roots\Bedrock
* @author Roots
* @link https://roots.io/
*/
class Autoloader
{
/** @var array Store Autoloader cache and site option */
private static $cache;
/** @var array Autoloaded plugins */
private static $auto_plugins;
/** @var array Autoloaded mu-plugins */
private static $mu_plugins;
/** @var int Number of plugins */
private static $count;
/** @var array Newly activated plugins */
private static $activated;
/** @var string Relative path to the mu-plugins dir */
private static $relative_path;
/** @var static Singleton instance */
private static $_single;
/**
* Create singleton, populate vars, and set WordPress hooks
*/
public function __construct()
{
if (isset(self::$_single)) {
return;
}
self::$_single = $this;
self::$relative_path = '/../' . basename(__DIR__);
if (is_admin()) {
add_filter('show_advanced_plugins', [$this, 'showInAdmin'], 0, 2);
}
$this->loadPlugins();
}
/**
* Run some checks then autoload our plugins.
*/
public function loadPlugins()
{
$this->checkCache();
$this->validatePlugins();
$this->countPlugins();
array_map(static function () {
include_once(WPMU_PLUGIN_DIR . '/' . func_get_args()[0]);
}, array_keys(self::$cache['plugins']));
$this->pluginHooks();
}
/**
* Filter show_advanced_plugins to display the autoloaded plugins.
* @param $bool bool Whether to show the advanced plugins for the specified plugin type.
* @param $type string The plugin type, i.e., `mustuse` or `dropins`
* @return bool We return `false` to prevent WordPress from overriding our work
* {@internal We add the plugin details ourselves, so we return false to disable the filter.}
*/
public function showInAdmin($show, $type)
{
$screen = get_current_screen();
$current = is_multisite() ? 'plugins-network' : 'plugins';
if ($screen->{'base'} != $current || $type != 'mustuse' || !current_user_can('activate_plugins')) {
return $show;
}
$this->updateCache();
self::$auto_plugins = array_map(function ($auto_plugin) {
$auto_plugin['Name'] .= ' *';
return $auto_plugin;
}, self::$auto_plugins);
$GLOBALS['plugins']['mustuse'] = array_unique(array_merge(self::$auto_plugins, self::$mu_plugins), SORT_REGULAR);
return false;
}
/**
* This sets the cache or calls for an update
*/
private function checkCache()
{
$cache = get_site_option('bedrock_autoloader');
if ($cache === false) {
$this->updateCache();
return;
}
self::$cache = $cache;
}
/**
* Get the plugins and mu-plugins from the mu-plugin path and remove duplicates.
* Check cache against current plugins for newly activated plugins.
* After that, we can update the cache.
*/
private function updateCache()
{
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
self::$auto_plugins = get_plugins(self::$relative_path);
self::$mu_plugins = get_mu_plugins();
$plugins = array_diff_key(self::$auto_plugins, self::$mu_plugins);
$rebuild = !is_array(self::$cache['plugins']);
self::$activated = ($rebuild) ? $plugins : array_diff_key($plugins, self::$cache['plugins']);
self::$cache = array('plugins' => $plugins, 'count' => $this->countPlugins());
update_site_option('bedrock_autoloader', self::$cache);
}
/**
* This accounts for the plugin hooks that would run if the plugins were
* loaded as usual. Plugins are removed by deletion, so there's no way
* to deactivate or uninstall.
*/
private function pluginHooks()
{
if (!is_array(self::$activated)) {
return;
}
foreach (self::$activated as $plugin_file => $plugin_info) {
do_action('activate_' . $plugin_file);
}
}
/**
* Check that the plugin file exists, if it doesn't update the cache.
*/
private function validatePlugins()
{
foreach (self::$cache['plugins'] as $plugin_file => $plugin_info) {
if (!file_exists(WPMU_PLUGIN_DIR . '/' . $plugin_file)) {
$this->updateCache();
break;
}
}
}
/**
* Count the number of autoloaded plugins.
*
* Count our plugins (but only once) by counting the top level folders in the
* mu-plugins dir. If it's more or less than last time, update the cache.
*
* @return int Number of autoloaded plugins.
*/
private function countPlugins()
{
if (isset(self::$count)) {
return self::$count;
}
$count = count(glob(WPMU_PLUGIN_DIR . '/*/', GLOB_ONLYDIR | GLOB_NOSORT));
if (!isset(self::$cache['count']) || $count != self::$cache['count']) {
self::$count = $count;
$this->updateCache();
}
return self::$count;
}
}
new Autoloader();
<?php
/*
Plugin Name: Disallow Indexing
Plugin URI: https://roots.io/bedrock/
Description: Disallow indexing of your site on non-production environments.
Version: 1.0.0
Author: Roots
Author URI: https://roots.io/
License: MIT License
*/
if (WP_ENV !== 'production' && !is_admin()) {
add_action('pre_option_blog_public', '__return_zero');
}
<?php
/*
Plugin Name: Register Theme Directory
Plugin URI: https://roots.io/bedrock/
Description: Register default theme directory
Version: 1.0.0
Author: Roots
Author URI: https://roots.io/
License: MIT License
*/
if (!defined('WP_DEFAULT_THEME')) {
register_theme_directory(ABSPATH . 'wp-content/themes');
}
assets/.sass-cache
assets/bower_components
assets/styles
assets/vendor
languages/*.mo
{
"name": "bezirksblaetter",
"homepage": "https://www.bezirksblaetter.cz",
"authors": [
"Ceslav Przywara <ceslav@przywara.cz>"
],
"license": "MIT",
"private": true,
"dependencies": {
"foundation-sites": "~6.3",
"photoswipe": "^4.1.1"
}
}
#!/usr/bin/env bash
#
# Build theme assets.
echo 'Building theme assets ...'
# Grab current working directory
CWD=$(pwd)
# CD into assets directory
cd $(dirname $0) || exit 1
# Update Bower packages
echo 'Updating bower packages ...'
bower update
# Remove PhotoSwipe directory, if it exists.
[ -d vendor/photoswipe ] && rm -rf vendor/photoswipe
# Copy PhotoSwipe dist folder to proper destination
echo 'Deploying PhotoSwipe ...'
cp -r bower_components/photoswipe/dist vendor/photoswipe
# Compile CSS
echo 'Compiling CSS ...'
sass --compass --style compressed --sourcemap=none --update sass/:styles/
cd $CWD
echo 'Done!'
exit 0
This diff is collapsed.
<svg version="1.2" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 6h-1.586l-1-1c-.579-.579-1.595-1-2.414-1h-4c-.819 0-1.835.421-2.414 1l-1 1h-1.586c-1.654 0-3 1.346-3 3v8c0 1.654 1.346 3 3 3h14c1.654 0 3-1.346 3-3v-8c0-1.654-1.346-3-3-3zm-7 10c-1.933 0-3.5-1.568-3.5-3.5 0-1.934 1.567-3.5 3.5-3.5s3.5 1.566 3.5 3.5c0 1.932-1.567 3.5-3.5 3.5zm6-4.701c-.719 0-1.3-.58-1.3-1.299s.581-1.301 1.3-1.301 1.3.582 1.3 1.301-.581 1.299-1.3 1.299z"/></svg>
\ No newline at end of file
@mixin grid-vertical-gutter($gutter: $grid-column-gutter) {
@if type-of($gutter) == 'map' {
@each $breakpoint, $value in $gutter {
$padding: rem-calc($value) / 2;
@include breakpoint($breakpoint) {
padding-top: $padding;
padding-bottom: $padding;
}
}
}
}
@mixin hocus {
&:hover, &:focus {
@content
}
}
@mixin lights-off {
html.lights-off & {
@content;
}
}
@mixin adaptive-image-width($percentage: 100%) {
width: $percentage;
height: auto;
}
@mixin adaptive-image-height($percentage: 100%) {
width: auto;
height: $percentage;
}
@mixin responsive-image-width($percentage: 100%) {
max-width: $percentage;
height: auto;
}
@mixin responsive-image-height($percentage: 100%) {
width: auto;
max-height: $percentage;
}
@mixin anchor-with-icon($element: after, $font-size: 1em, $spacing: 0.25em) {
position: relative;
&:#{$element} {
display: inline-block;
vertical-align: middle;
text-decoration: none;
@if $element == before {
margin-right: $spacing;
}
@if $element == after {
margin-left: $spacing;
}
font-size: $font-size;
}
}
//// Site setting
$offset : 0.5rem;
$text-shadow : 1px 1px 1px rgba(32, 32, 32, 1);
$transition-duration : 0.4s;
// Vertical margin sizes:
$vertical-space: (
small: 1rem,
medium: 2rem,
large : 3rem,
);
// Gutter for media grid
$reduced-grid-column-gutter: (
small: map-get($grid-column-gutter, small) / 2,
medium: map-get($grid-column-gutter, medium) / 2,
);
//// Foundation framework settings
// 1. Global
// ---------
$global-width: rem-calc(1280px);
$body-font-family: 'Open Sans', Roboto, Arial, sans-serif;
// 2. Breakpoints
// --------------
$breakpoints: (
small: 0,
medium: 640px,
large: 960px,
xlarge: 1280px,
xxlarge: 1600px,
);