@@ -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 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return 1; |
32 | 32 | } |
33 | 33 | |
34 | - $salts = array_map(function ($key) { |
|
34 | + $salts = array_map(function($key) { |
|
35 | 35 | return sprintf("%s='%s'", $key, Installer::generateSalt()); |
36 | 36 | }, self::$KEYS); |
37 | 37 |
@@ -10,4 +10,4 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | $context = Timber::get_context(); |
13 | -Timber::render( '404.twig', $context ); |
|
13 | +Timber::render('404.twig', $context); |
@@ -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(); |
@@ -14,27 +14,27 @@ |
||
14 | 14 | * @since Timber 0.2 |
15 | 15 | */ |
16 | 16 | |
17 | -$templates = array( 'archive.twig', 'index.twig' ); |
|
17 | +$templates = array('archive.twig', 'index.twig'); |
|
18 | 18 | |
19 | 19 | $data = Timber::get_context(); |
20 | 20 | |
21 | 21 | $data['title'] = 'Archive'; |
22 | -if ( is_day() ) { |
|
23 | - $data['title'] = 'Archive: '.get_the_date( 'D M Y' ); |
|
24 | -} else if ( is_month() ) { |
|
25 | - $data['title'] = 'Archive: '.get_the_date( 'M Y' ); |
|
26 | -} else if ( is_year() ) { |
|
27 | - $data['title'] = 'Archive: '.get_the_date( 'Y' ); |
|
28 | -} else if ( is_tag() ) { |
|
29 | - $data['title'] = single_tag_title( '', false ); |
|
30 | -} else if ( is_category() ) { |
|
31 | - $data['title'] = single_cat_title( '', false ); |
|
32 | - array_unshift( $templates, 'archive-' . get_query_var( 'cat' ) . '.twig' ); |
|
33 | -} else if ( is_post_type_archive() ) { |
|
34 | - $data['title'] = post_type_archive_title( '', false ); |
|
35 | - array_unshift( $templates, 'archive-' . get_post_type() . '.twig' ); |
|
22 | +if (is_day()) { |
|
23 | + $data['title'] = 'Archive: '.get_the_date('D M Y'); |
|
24 | +} else if (is_month()) { |
|
25 | + $data['title'] = 'Archive: '.get_the_date('M Y'); |
|
26 | +} else if (is_year()) { |
|
27 | + $data['title'] = 'Archive: '.get_the_date('Y'); |
|
28 | +} else if (is_tag()) { |
|
29 | + $data['title'] = single_tag_title('', false); |
|
30 | +} else if (is_category()) { |
|
31 | + $data['title'] = single_cat_title('', false); |
|
32 | + array_unshift($templates, 'archive-'.get_query_var('cat').'.twig'); |
|
33 | +} else if (is_post_type_archive()) { |
|
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(); |
39 | 39 | |
40 | -Timber::render( $templates, $data ); |
|
40 | +Timber::render($templates, $data); |
@@ -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 ); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $data = Timber::get_context(); |
14 | 14 | $data['posts'] = Timber::get_posts(); |
15 | -if ( isset( $wp_query->query_vars['author'] ) ) { |
|
16 | - $author = new TimberUser( $wp_query->query_vars['author'] ); |
|
15 | +if (isset($wp_query->query_vars['author'])) { |
|
16 | + $author = new TimberUser($wp_query->query_vars['author']); |
|
17 | 17 | $data['author'] = $author; |
18 | - $data['title'] = 'Author Archives: ' . $author->name(); |
|
18 | + $data['title'] = 'Author Archives: '.$author->name(); |
|
19 | 19 | } |
20 | -Timber::render( array( 'author.twig', 'archive.twig' ), $data ); |
|
20 | +Timber::render(array('author.twig', 'archive.twig'), $data); |
@@ -10,22 +10,22 @@ |
||
10 | 10 | |
11 | 11 | <section class="no-results not-found"> |
12 | 12 | <header class="page-header"> |
13 | - <h1 class="page-title"><?php _e( 'Nothing Found', 'stash' ); ?></h1> |
|
13 | + <h1 class="page-title"><?php _e('Nothing Found', 'stash'); ?></h1> |
|
14 | 14 | </header><!-- .page-header --> |
15 | 15 | |
16 | 16 | <div class="page-content"> |
17 | - <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> |
|
17 | + <?php if (is_home() && current_user_can('publish_posts')) : ?> |
|
18 | 18 | |
19 | - <p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'stash' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p> |
|
19 | + <p><?php printf(__('Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'stash'), esc_url(admin_url('post-new.php'))); ?></p> |
|
20 | 20 | |
21 | - <?php elseif ( is_search() ) : ?> |
|
21 | + <?php elseif (is_search()) : ?> |
|
22 | 22 | |
23 | - <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'stash' ); ?></p> |
|
23 | + <p><?php _e('Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'stash'); ?></p> |
|
24 | 24 | <?php get_search_form(); ?> |
25 | 25 | |
26 | 26 | <?php else : ?> |
27 | 27 | |
28 | - <p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'stash' ); ?></p> |
|
28 | + <p><?php _e('It seems we can’t find what you’re looking for. Perhaps searching can help.', 'stash'); ?></p> |
|
29 | 29 | <?php get_search_form(); ?> |
30 | 30 | |
31 | 31 | <?php endif; ?> |
@@ -23,9 +23,12 @@ |
||
23 | 23 | <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'stash' ); ?></p> |
24 | 24 | <?php get_search_form(); ?> |
25 | 25 | |
26 | - <?php else : ?> |
|
26 | + <?php else { |
|
27 | + : ?> |
|
27 | 28 | |
28 | - <p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'stash' ); ?></p> |
|
29 | + <p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'stash' ); |
|
30 | +} |
|
31 | +?></p> |
|
29 | 32 | <?php get_search_form(); ?> |
30 | 33 | |
31 | 34 | <?php endif; ?> |
@@ -10,9 +10,9 @@ |
||
10 | 10 | |
11 | 11 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
12 | 12 | <header class="entry-header"> |
13 | - <?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> |
|
13 | + <?php the_title(sprintf('<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> |
|
14 | 14 | |
15 | - <?php if ( 'post' == get_post_type() ) : ?> |
|
15 | + <?php if ('post' == get_post_type()) : ?> |
|
16 | 16 | <div class="entry-meta"> |
17 | 17 | <?php stash_posted_on(); ?> |
18 | 18 | </div><!-- .entry-meta --> |
@@ -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(); |
@@ -4,10 +4,10 @@ |
||
4 | 4 | * We use this to end our output buffer (started in header.php) and render into the view/page-plugin.twig template. |
5 | 5 | */ |
6 | 6 | $timberContext = $GLOBALS['timberContext']; |
7 | -if ( ! isset( $timberContext ) ) { |
|
8 | - throw new \Exception( 'Timber context not set in footer.' ); |
|
7 | +if (!isset($timberContext)) { |
|
8 | + throw new \Exception('Timber context not set in footer.'); |
|
9 | 9 | } |
10 | 10 | $timberContext['content'] = ob_get_contents(); |
11 | 11 | ob_end_clean(); |
12 | -$templates = array( 'page-plugin.twig' ); |
|
13 | -Timber::render( $templates, $timberContext ); |
|
12 | +$templates = array('page-plugin.twig'); |
|
13 | +Timber::render($templates, $timberContext); |
@@ -55,8 +55,10 @@ |
||
55 | 55 | foreach ($list_searcheable_acf as $searcheable_acf) : |
56 | 56 | if ($searcheable_acf == $list_searcheable_acf[0]): |
57 | 57 | $where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
58 | - else : |
|
58 | + else { |
|
59 | + : |
|
59 | 60 | $where .= " OR (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
61 | + } |
|
60 | 62 | endif; |
61 | 63 | endforeach; |
62 | 64 |
@@ -54,9 +54,9 @@ |
||
54 | 54 | |
55 | 55 | foreach ($list_searcheable_acf as $searcheable_acf) : |
56 | 56 | if ($searcheable_acf == $list_searcheable_acf[0]): |
57 | - $where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
57 | + $where .= " (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
58 | 58 | else : |
59 | - $where .= " OR (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
59 | + $where .= " OR (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
60 | 60 | endif; |
61 | 61 | endforeach; |
62 | 62 |
@@ -7,4 +7,4 @@ |
||
7 | 7 | * @subpackage Timber |
8 | 8 | */ |
9 | 9 | |
10 | -Timber::render( array( 'sidebar.twig' ), $data ); |
|
10 | +Timber::render(array('sidebar.twig'), $data); |