@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use Composer\Script\Event; |
6 | 6 | |
7 | 7 | class Installer { |
8 | - public static $KEYS = array( |
|
8 | + public static $KEYS = array( |
|
9 | 9 | 'AUTH_KEY', |
10 | 10 | 'SECURE_AUTH_KEY', |
11 | 11 | 'LOGGED_IN_KEY', |
@@ -14,51 +14,51 @@ discard block |
||
14 | 14 | 'SECURE_AUTH_SALT', |
15 | 15 | 'LOGGED_IN_SALT', |
16 | 16 | 'NONCE_SALT' |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | - public static function addSalts(Event $event) { |
|
19 | + public static function addSalts(Event $event) { |
|
20 | 20 | $root = dirname(dirname(dirname(__DIR__))); |
21 | 21 | $composer = $event->getComposer(); |
22 | 22 | $io = $event->getIO(); |
23 | 23 | |
24 | 24 | if (!$io->isInteractive()) { |
25 | - $generate_salts = $composer->getConfig()->get('generate-salts'); |
|
25 | + $generate_salts = $composer->getConfig()->get('generate-salts'); |
|
26 | 26 | } else { |
27 | - $generate_salts = $io->askConfirmation('<info>Generate salts and append to .env file?</info> [<comment>Y,n</comment>]? ', true); |
|
27 | + $generate_salts = $io->askConfirmation('<info>Generate salts and append to .env file?</info> [<comment>Y,n</comment>]? ', true); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if (!$generate_salts) { |
31 | - return 1; |
|
31 | + return 1; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $salts = array_map(function ($key) { |
35 | - return sprintf("%s='%s'", $key, Installer::generateSalt()); |
|
35 | + return sprintf("%s='%s'", $key, Installer::generateSalt()); |
|
36 | 36 | }, self::$KEYS); |
37 | 37 | |
38 | 38 | $env_file = "{$root}/.env"; |
39 | 39 | |
40 | 40 | if (copy("{$root}/.env.example", $env_file)) { |
41 | - file_put_contents($env_file, implode($salts, "\n"), FILE_APPEND | LOCK_EX); |
|
41 | + file_put_contents($env_file, implode($salts, "\n"), FILE_APPEND | LOCK_EX); |
|
42 | 42 | } else { |
43 | - $io->write("<error>An error occured while copying your .env file</error>"); |
|
44 | - return 1; |
|
43 | + $io->write("<error>An error occured while copying your .env file</error>"); |
|
44 | + return 1; |
|
45 | + } |
|
45 | 46 | } |
46 | - } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Slightly modified/simpler version of wp_generate_password |
|
50 | - * https://github.com/WordPress/WordPress/blob/cd8cedc40d768e9e1d5a5f5a08f1bd677c804cb9/wp-includes/pluggable.php#L1575 |
|
51 | - */ |
|
52 | - public static function generateSalt($length = 64) { |
|
48 | + /** |
|
49 | + * Slightly modified/simpler version of wp_generate_password |
|
50 | + * https://github.com/WordPress/WordPress/blob/cd8cedc40d768e9e1d5a5f5a08f1bd677c804cb9/wp-includes/pluggable.php#L1575 |
|
51 | + */ |
|
52 | + public static function generateSalt($length = 64) { |
|
53 | 53 | $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; |
54 | 54 | $chars .= '!@#$%^&*()'; |
55 | 55 | $chars .= '-_ []{}<>~`+=,.;:/?|'; |
56 | 56 | |
57 | 57 | $salt = ''; |
58 | 58 | for ($i = 0; $i < $length; $i++) { |
59 | - $salt .= substr($chars, rand(0, strlen($chars) - 1), 1); |
|
59 | + $salt .= substr($chars, rand(0, strlen($chars) - 1), 1); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $salt; |
63 | - } |
|
63 | + } |
|
64 | 64 | } |
@@ -20,19 +20,19 @@ |
||
20 | 20 | |
21 | 21 | $data['title'] = 'Archive'; |
22 | 22 | if ( is_day() ) { |
23 | - $data['title'] = 'Archive: '.get_the_date( 'D M Y' ); |
|
23 | + $data['title'] = 'Archive: '.get_the_date( 'D M Y' ); |
|
24 | 24 | } else if ( is_month() ) { |
25 | - $data['title'] = 'Archive: '.get_the_date( 'M Y' ); |
|
25 | + $data['title'] = 'Archive: '.get_the_date( 'M Y' ); |
|
26 | 26 | } else if ( is_year() ) { |
27 | - $data['title'] = 'Archive: '.get_the_date( 'Y' ); |
|
27 | + $data['title'] = 'Archive: '.get_the_date( 'Y' ); |
|
28 | 28 | } else if ( is_tag() ) { |
29 | - $data['title'] = single_tag_title( '', false ); |
|
29 | + $data['title'] = single_tag_title( '', false ); |
|
30 | 30 | } else if ( is_category() ) { |
31 | - $data['title'] = single_cat_title( '', false ); |
|
32 | - array_unshift( $templates, 'archive-' . get_query_var( 'cat' ) . '.twig' ); |
|
31 | + $data['title'] = single_cat_title( '', false ); |
|
32 | + array_unshift( $templates, 'archive-' . get_query_var( 'cat' ) . '.twig' ); |
|
33 | 33 | } else if ( is_post_type_archive() ) { |
34 | - $data['title'] = post_type_archive_title( '', false ); |
|
35 | - array_unshift( $templates, 'archive-' . get_post_type() . '.twig' ); |
|
34 | + $data['title'] = post_type_archive_title( '', false ); |
|
35 | + array_unshift( $templates, 'archive-' . get_post_type() . '.twig' ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $data['posts'] = Timber::get_posts(); |
@@ -13,8 +13,8 @@ |
||
13 | 13 | $data = Timber::get_context(); |
14 | 14 | $data['posts'] = Timber::get_posts(); |
15 | 15 | if ( isset( $wp_query->query_vars['author'] ) ) { |
16 | - $author = new TimberUser( $wp_query->query_vars['author'] ); |
|
17 | - $data['author'] = $author; |
|
18 | - $data['title'] = 'Author Archives: ' . $author->name(); |
|
16 | + $author = new TimberUser( $wp_query->query_vars['author'] ); |
|
17 | + $data['author'] = $author; |
|
18 | + $data['title'] = 'Author Archives: ' . $author->name(); |
|
19 | 19 | } |
20 | 20 | Timber::render( array( 'author.twig', 'archive.twig' ), $data ); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | */ |
6 | 6 | $timberContext = $GLOBALS['timberContext']; |
7 | 7 | if ( ! isset( $timberContext ) ) { |
8 | - throw new \Exception( 'Timber context not set in footer.' ); |
|
8 | + throw new \Exception( 'Timber context not set in footer.' ); |
|
9 | 9 | } |
10 | 10 | $timberContext['content'] = ob_get_contents(); |
11 | 11 | ob_end_clean(); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $context['comment_form'] = TimberHelper::get_comment_form(); |
17 | 17 | |
18 | 18 | if ( post_password_required( $post->ID ) ) { |
19 | - Timber::render( 'single-password.twig', $context ); |
|
19 | + Timber::render( 'single-password.twig', $context ); |
|
20 | 20 | } else { |
21 | - Timber::render( array( 'single-' . $post->ID . '.twig', 'single-' . $post->post_type . '.twig', 'single.twig' ), $context ); |
|
21 | + Timber::render( array( 'single-' . $post->ID . '.twig', 'single-' . $post->post_type . '.twig', 'single.twig' ), $context ); |
|
22 | 22 | } |
@@ -14,84 +14,84 @@ discard block |
||
14 | 14 | if (!is_blog_installed()) { return; } |
15 | 15 | |
16 | 16 | class Autoloader { |
17 | - private static $cache; // Stores our plugin cache and site option. |
|
18 | - private static $auto_plugins; // Contains the autoloaded plugins (only when needed). |
|
19 | - private static $mu_plugins; // Contains the mu plugins (only when needed). |
|
20 | - private static $count; // Contains the plugin count. |
|
21 | - private static $activated; // Newly activated plugins. |
|
22 | - private static $relative_path; // Relative path to the mu-plugins dir. |
|
23 | - private static $_single; // Let's make this a singleton. |
|
24 | - |
|
25 | - public function __construct() { |
|
17 | + private static $cache; // Stores our plugin cache and site option. |
|
18 | + private static $auto_plugins; // Contains the autoloaded plugins (only when needed). |
|
19 | + private static $mu_plugins; // Contains the mu plugins (only when needed). |
|
20 | + private static $count; // Contains the plugin count. |
|
21 | + private static $activated; // Newly activated plugins. |
|
22 | + private static $relative_path; // Relative path to the mu-plugins dir. |
|
23 | + private static $_single; // Let's make this a singleton. |
|
24 | + |
|
25 | + public function __construct() { |
|
26 | 26 | if (isset(self::$_single)) { return; } |
27 | 27 | |
28 | 28 | self::$_single = $this; // Singleton set. |
29 | 29 | self::$relative_path = '/../' . basename(__DIR__); // Rel path set. |
30 | 30 | |
31 | 31 | if (is_admin()) { |
32 | - add_filter('show_advanced_plugins', array($this, 'showInAdmin'), 0, 2); // Admin only filter. |
|
32 | + add_filter('show_advanced_plugins', array($this, 'showInAdmin'), 0, 2); // Admin only filter. |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $this->loadPlugins(); |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Run some checks then autoload our plugins. |
|
40 | - */ |
|
41 | - public function loadPlugins() { |
|
38 | + /** |
|
39 | + * Run some checks then autoload our plugins. |
|
40 | + */ |
|
41 | + public function loadPlugins() { |
|
42 | 42 | $this->checkCache(); |
43 | 43 | $this->validatePlugins(); |
44 | 44 | $this->countPlugins(); |
45 | 45 | |
46 | 46 | foreach (self::$cache['plugins'] as $plugin_file => $plugin_info) { |
47 | - include_once(WPMU_PLUGIN_DIR . '/' . $plugin_file); |
|
47 | + include_once(WPMU_PLUGIN_DIR . '/' . $plugin_file); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $this->pluginHooks(); |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Filter show_advanced_plugins to display the autoloaded plugins. |
|
55 | - */ |
|
56 | - public function showInAdmin($bool, $type) { |
|
53 | + /** |
|
54 | + * Filter show_advanced_plugins to display the autoloaded plugins. |
|
55 | + */ |
|
56 | + public function showInAdmin($bool, $type) { |
|
57 | 57 | $screen = get_current_screen(); |
58 | 58 | $current = is_multisite() ? 'plugins-network' : 'plugins'; |
59 | 59 | |
60 | 60 | if ($screen->{'base'} != $current || $type != 'mustuse' || !current_user_can('activate_plugins')) { |
61 | - return $bool; |
|
61 | + return $bool; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $this->updateCache(); // May as well update the transient cache whilst here. |
65 | 65 | |
66 | 66 | self::$auto_plugins = array_map(function ($auto_plugin) { |
67 | - $auto_plugin['Name'] .= ' *'; |
|
68 | - return $auto_plugin; |
|
67 | + $auto_plugin['Name'] .= ' *'; |
|
68 | + return $auto_plugin; |
|
69 | 69 | }, self::$auto_plugins); |
70 | 70 | |
71 | 71 | $GLOBALS['plugins']['mustuse'] = array_unique(array_merge(self::$auto_plugins, self::$mu_plugins), SORT_REGULAR); |
72 | 72 | |
73 | 73 | return false; // Prevent WordPress overriding our work. |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * This sets the cache or calls for an update |
|
78 | - */ |
|
79 | - private function checkCache() { |
|
76 | + /** |
|
77 | + * This sets the cache or calls for an update |
|
78 | + */ |
|
79 | + private function checkCache() { |
|
80 | 80 | $cache = get_site_option('bedrock_autoloader'); |
81 | 81 | |
82 | 82 | if ($cache === false) { |
83 | - return $this->updateCache(); |
|
83 | + return $this->updateCache(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | self::$cache = $cache; |
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Get the plugins and mu-plugins from the mu-plugin path and remove duplicates. |
|
91 | - * Check cache against current plugins for newly activated plugins. |
|
92 | - * After that, we can update the cache. |
|
93 | - */ |
|
94 | - private function updateCache() { |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Get the plugins and mu-plugins from the mu-plugin path and remove duplicates. |
|
91 | + * Check cache against current plugins for newly activated plugins. |
|
92 | + * After that, we can update the cache. |
|
93 | + */ |
|
94 | + private function updateCache() { |
|
95 | 95 | require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
96 | 96 | |
97 | 97 | self::$auto_plugins = get_plugins(self::$relative_path); |
@@ -102,49 +102,49 @@ discard block |
||
102 | 102 | self::$cache = array('plugins' => $plugins, 'count' => $this->countPlugins()); |
103 | 103 | |
104 | 104 | update_site_option('bedrock_autoloader', self::$cache); |
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * This accounts for the plugin hooks that would run if the plugins were |
|
109 | - * loaded as usual. Plugins are removed by deletion, so there's no way |
|
110 | - * to deactivate or uninstall. |
|
111 | - */ |
|
112 | - private function pluginHooks() { |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * This accounts for the plugin hooks that would run if the plugins were |
|
109 | + * loaded as usual. Plugins are removed by deletion, so there's no way |
|
110 | + * to deactivate or uninstall. |
|
111 | + */ |
|
112 | + private function pluginHooks() { |
|
113 | 113 | if (!is_array(self::$activated)) { return; } |
114 | 114 | |
115 | 115 | foreach (self::$activated as $plugin_file => $plugin_info) { |
116 | - do_action('activate_' . $plugin_file); |
|
116 | + do_action('activate_' . $plugin_file); |
|
117 | + } |
|
117 | 118 | } |
118 | - } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Check that the plugin file exists, if it doesn't update the cache. |
|
122 | - */ |
|
123 | - private function validatePlugins() { |
|
120 | + /** |
|
121 | + * Check that the plugin file exists, if it doesn't update the cache. |
|
122 | + */ |
|
123 | + private function validatePlugins() { |
|
124 | 124 | foreach (self::$cache['plugins'] as $plugin_file => $plugin_info) { |
125 | - if (!file_exists(WPMU_PLUGIN_DIR . '/' . $plugin_file)) { |
|
125 | + if (!file_exists(WPMU_PLUGIN_DIR . '/' . $plugin_file)) { |
|
126 | 126 | $this->updateCache(); |
127 | 127 | break; |
128 | - } |
|
128 | + } |
|
129 | + } |
|
129 | 130 | } |
130 | - } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Count our plugins (but only once) by counting the top level folders in the |
|
134 | - * mu-plugins dir. If it's more or less than last time, update the cache. |
|
135 | - */ |
|
136 | - private function countPlugins() { |
|
132 | + /** |
|
133 | + * Count our plugins (but only once) by counting the top level folders in the |
|
134 | + * mu-plugins dir. If it's more or less than last time, update the cache. |
|
135 | + */ |
|
136 | + private function countPlugins() { |
|
137 | 137 | if (isset(self::$count)) { return self::$count; } |
138 | 138 | |
139 | 139 | $count = count(glob(WPMU_PLUGIN_DIR . '/*/', GLOB_ONLYDIR | GLOB_NOSORT)); |
140 | 140 | |
141 | 141 | if (!isset(self::$cache['count']) || $count != self::$cache['count']) { |
142 | - self::$count = $count; |
|
143 | - $this->updateCache(); |
|
142 | + self::$count = $count; |
|
143 | + $this->updateCache(); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return self::$count; |
147 | - } |
|
147 | + } |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | new Autoloader(); |
@@ -17,19 +17,19 @@ |
||
17 | 17 | |
18 | 18 | <div class="entry-content"> |
19 | 19 | <?php |
20 | - /* translators: %s: Name of current post */ |
|
21 | - the_content( sprintf( |
|
22 | - __( 'Continue reading %s <span class="meta-nav">→</span>', 'stash' ), |
|
23 | - the_title( '<span class="screen-reader-text">"', '"</span>', false ) |
|
24 | - ) ); |
|
25 | - ?> |
|
20 | + /* translators: %s: Name of current post */ |
|
21 | + the_content( sprintf( |
|
22 | + __( 'Continue reading %s <span class="meta-nav">→</span>', 'stash' ), |
|
23 | + the_title( '<span class="screen-reader-text">"', '"</span>', false ) |
|
24 | + ) ); |
|
25 | + ?> |
|
26 | 26 | |
27 | 27 | <?php |
28 | - wp_link_pages( array( |
|
29 | - 'before' => '<div class="page-links">' . __( 'Pages:', 'stash' ), |
|
30 | - 'after' => '</div>', |
|
31 | - ) ); |
|
32 | - ?> |
|
28 | + wp_link_pages( array( |
|
29 | + 'before' => '<div class="page-links">' . __( 'Pages:', 'stash' ), |
|
30 | + 'after' => '</div>', |
|
31 | + ) ); |
|
32 | + ?> |
|
33 | 33 | </div><!-- .entry-content --> |
34 | 34 | |
35 | 35 | <footer class="entry-footer"> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * return early without loading the comments. |
15 | 15 | */ |
16 | 16 | if ( post_password_required() ) { |
17 | - return; |
|
17 | + return; |
|
18 | 18 | } |
19 | 19 | ?> |
20 | 20 | |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | <?php if ( have_comments() ) : ?> |
26 | 26 | <h2 class="comments-title"> |
27 | 27 | <?php |
28 | - printf( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'stash' ), |
|
29 | - number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); |
|
30 | - ?> |
|
28 | + printf( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'stash' ), |
|
29 | + number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); |
|
30 | + ?> |
|
31 | 31 | </h2> |
32 | 32 | |
33 | 33 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | |
45 | 45 | <ol class="comment-list"> |
46 | 46 | <?php |
47 | - wp_list_comments( array( |
|
48 | - 'style' => 'ol', |
|
49 | - 'short_ping' => true, |
|
50 | - ) ); |
|
51 | - ?> |
|
47 | + wp_list_comments( array( |
|
48 | + 'style' => 'ol', |
|
49 | + 'short_ping' => true, |
|
50 | + ) ); |
|
51 | + ?> |
|
52 | 52 | </ol><!-- .comment-list --> |
53 | 53 | |
54 | 54 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | <?php endif; // have_comments() ?> |
67 | 67 | |
68 | 68 | <?php |
69 | - // If comments are closed and there are comments, let's leave a little note, shall we? |
|
70 | - if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : |
|
71 | - ?> |
|
69 | + // If comments are closed and there are comments, let's leave a little note, shall we? |
|
70 | + if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : |
|
71 | + ?> |
|
72 | 72 | <p class="no-comments"><?php _e( 'Comments are closed.', 'stash' ); ?></p> |
73 | 73 | <?php endif; ?> |
74 | 74 |
@@ -16,11 +16,11 @@ |
||
16 | 16 | <div class="entry-content"> |
17 | 17 | <?php the_content(); ?> |
18 | 18 | <?php |
19 | - wp_link_pages( array( |
|
20 | - 'before' => '<div class="page-links">' . __( 'Pages:', 'stash' ), |
|
21 | - 'after' => '</div>', |
|
22 | - ) ); |
|
23 | - ?> |
|
19 | + wp_link_pages( array( |
|
20 | + 'before' => '<div class="page-links">' . __( 'Pages:', 'stash' ), |
|
21 | + 'after' => '</div>', |
|
22 | + ) ); |
|
23 | + ?> |
|
24 | 24 | </div><!-- .entry-content --> |
25 | 25 | |
26 | 26 | <footer class="entry-footer"> |