@@ -9,28 +9,28 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentyfifteen extends Sensei__S { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | 17 | |
18 | - // output inline styles |
|
19 | - $this->print_styles(); |
|
18 | + // output inline styles |
|
19 | + $this->print_styles(); |
|
20 | 20 | |
21 | - // call the parent starting wrappers |
|
22 | - parent::wrapper_start(); |
|
21 | + // call the parent starting wrappers |
|
22 | + parent::wrapper_start(); |
|
23 | 23 | |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * Output the style for the |
|
29 | - * twenty fifteen theme integration. |
|
30 | - * |
|
31 | - * @since 1.9.0 |
|
32 | - */ |
|
33 | - private function print_styles(){?> |
|
27 | + /** |
|
28 | + * Output the style for the |
|
29 | + * twenty fifteen theme integration. |
|
30 | + * |
|
31 | + * @since 1.9.0 |
|
32 | + */ |
|
33 | + private function print_styles(){?> |
|
34 | 34 | |
35 | 35 | <style> |
36 | 36 | @media screen and (min-width: 59.6875em){ |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | |
18 | 18 | // output inline styles |
19 | 19 | $this->print_styles(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since 1.9.0 |
32 | 32 | */ |
33 | - private function print_styles(){?> |
|
33 | + private function print_styles() {?> |
|
34 | 34 | |
35 | 35 | <style> |
36 | 36 | @media screen and (min-width: 59.6875em){ |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ ?> |
|
16 | + public function wrapper_start() { ?> |
|
17 | 17 | <div id="primary" class="content-area"> |
18 | 18 | <main id="main" class="site-main" role="main"> |
19 | 19 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @since 1.9.0 |
26 | 26 | */ |
27 | - public function wrapper_end(){ ?> |
|
27 | + public function wrapper_end() { ?> |
|
28 | 28 | |
29 | 29 | </main> <!-- main-site --> |
30 | 30 | </div> <!-- content-area --> |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Class Sensei__S |
|
4 | - * |
|
5 | - * Responsible for wrapping for the underscores theme |
|
6 | - * with the correct markup |
|
7 | - * |
|
8 | - * |
|
9 | - * @package Views |
|
10 | - * @subpackage Theme-Integration |
|
11 | - * @author Automattic |
|
12 | - * |
|
13 | - * @since 1.9.0 |
|
3 | + * Class Sensei__S |
|
4 | + * |
|
5 | + * Responsible for wrapping for the underscores theme |
|
6 | + * with the correct markup |
|
7 | + * |
|
8 | + * |
|
9 | + * @package Views |
|
10 | + * @subpackage Theme-Integration |
|
11 | + * @author Automattic |
|
12 | + * |
|
13 | + * @since 1.9.0 |
|
14 | 14 | */ |
15 | 15 | Class Sensei__S { |
16 | 16 | |
17 | - /** |
|
18 | - * Output opening wrappers |
|
19 | - * @since 1.9.0 |
|
20 | - */ |
|
21 | - public function wrapper_start(){ ?> |
|
17 | + /** |
|
18 | + * Output opening wrappers |
|
19 | + * @since 1.9.0 |
|
20 | + */ |
|
21 | + public function wrapper_start(){ ?> |
|
22 | 22 | <div id="primary" class="content-area"> |
23 | 23 | <main id="main" class="site-main" role="main"> |
24 | 24 | |
25 | 25 | <?php } |
26 | 26 | |
27 | - /** |
|
28 | - * Output closing wrappers |
|
29 | - * |
|
30 | - * @since 1.9.0 |
|
31 | - */ |
|
32 | - public function wrapper_end(){ ?> |
|
27 | + /** |
|
28 | + * Output closing wrappers |
|
29 | + * |
|
30 | + * @since 1.9.0 |
|
31 | + */ |
|
32 | + public function wrapper_end(){ ?> |
|
33 | 33 | |
34 | 34 | </main> <!-- main-site --> |
35 | 35 | </div> <!-- content-area --> |
36 | 36 | |
37 | 37 | <?php |
38 | 38 | |
39 | - get_sidebar(); |
|
39 | + get_sidebar(); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | } // end class |
@@ -9,24 +9,24 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentythirteen { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
17 | - ?> |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
20 | 20 | <div id="content" role="main" class="entry-content"> |
21 | 21 | |
22 | 22 | <?php } |
23 | 23 | |
24 | - /** |
|
25 | - * Output closing wrappers |
|
26 | - * |
|
27 | - * @since 1.9.0 |
|
28 | - */ |
|
29 | - public function wrapper_end(){ ?> |
|
24 | + /** |
|
25 | + * Output closing wrappers |
|
26 | + * |
|
27 | + * @since 1.9.0 |
|
28 | + */ |
|
29 | + public function wrapper_end(){ ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 1.9.0 |
28 | 28 | */ |
29 | - public function wrapper_end(){ ?> |
|
29 | + public function wrapper_end() { ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -7,4 +7,4 @@ |
||
7 | 7 | * |
8 | 8 | * @since 1.9.0 |
9 | 9 | */ |
10 | -Class Sensei_Twentysixteen extends Sensei__S{ } |
|
10 | +Class Sensei_Twentysixteen extends Sensei__S { } |
@@ -9,24 +9,24 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentythirteen { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
17 | - ?> |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
20 | 20 | <div id="content" role="main" class="entry-content"> |
21 | 21 | |
22 | 22 | <?php } |
23 | 23 | |
24 | - /** |
|
25 | - * Output closing wrappers |
|
26 | - * |
|
27 | - * @since 1.9.0 |
|
28 | - */ |
|
29 | - public function wrapper_end(){ ?> |
|
24 | + /** |
|
25 | + * Output closing wrappers |
|
26 | + * |
|
27 | + * @since 1.9.0 |
|
28 | + */ |
|
29 | + public function wrapper_end(){ ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 1.9.0 |
28 | 28 | */ |
29 | - public function wrapper_end(){ ?> |
|
29 | + public function wrapper_end() { ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -9,24 +9,24 @@ |
||
9 | 9 | */ |
10 | 10 | Class Sensei_Twentythirteen { |
11 | 11 | |
12 | - /** |
|
13 | - * Output opening wrappers |
|
14 | - * @since 1.9.0 |
|
15 | - */ |
|
16 | - public function wrapper_start(){ |
|
17 | - ?> |
|
12 | + /** |
|
13 | + * Output opening wrappers |
|
14 | + * @since 1.9.0 |
|
15 | + */ |
|
16 | + public function wrapper_start(){ |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
20 | 20 | <div id="content" role="main" class="entry-content"> |
21 | 21 | |
22 | 22 | <?php } |
23 | 23 | |
24 | - /** |
|
25 | - * Output closing wrappers |
|
26 | - * |
|
27 | - * @since 1.9.0 |
|
28 | - */ |
|
29 | - public function wrapper_end(){ ?> |
|
24 | + /** |
|
25 | + * Output closing wrappers |
|
26 | + * |
|
27 | + * @since 1.9.0 |
|
28 | + */ |
|
29 | + public function wrapper_end(){ ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Output opening wrappers |
14 | 14 | * @since 1.9.0 |
15 | 15 | */ |
16 | - public function wrapper_start(){ |
|
16 | + public function wrapper_start() { |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="primary" class="site-content"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 1.9.0 |
28 | 28 | */ |
29 | - public function wrapper_end(){ ?> |
|
29 | + public function wrapper_end() { ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 | </div> |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Content wrappers Start |
|
4 | - * |
|
5 | - * All support theme wrappers can be found in includes/theme-integrations |
|
6 | - * |
|
7 | - * @author WooThemes |
|
8 | - * @package WooCommerce/Templates |
|
9 | - * @version 1.6.4 |
|
10 | - */ |
|
3 | + * Content wrappers Start |
|
4 | + * |
|
5 | + * All support theme wrappers can be found in includes/theme-integrations |
|
6 | + * |
|
7 | + * @author WooThemes |
|
8 | + * @package WooCommerce/Templates |
|
9 | + * @version 1.6.4 |
|
10 | + */ |
|
11 | 11 | ?> |
12 | 12 | <div id="container"> |
13 | 13 | <div id="content" role="main"> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function has_language_pack_available( $locale = null ) { |
93 | 93 | |
94 | - if ( is_null( $locale ) ) { |
|
94 | + if ( is_null( $locale ) ) { |
|
95 | 95 | |
96 | 96 | $locale = get_locale(); |
97 | 97 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | } |
111 | 111 | |
112 | - if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
112 | + if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
113 | 113 | |
114 | - return false; |
|
114 | + return false; |
|
115 | 115 | |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | $version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) ); |
119 | 119 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if ( ! defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * Initialize the language pack manager |
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | - add_action( 'update_option_WPLANG', array( $this, 'updated_language_option' ), 10, 2 ); |
|
32 | - add_filter( 'admin_init', array( $this, 'language_package_actions' ), 10 ); |
|
31 | + add_action('update_option_WPLANG', array($this, 'updated_language_option'), 10, 2); |
|
32 | + add_filter('admin_init', array($this, 'language_package_actions'), 10); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - public static function get_package_uri( $locale ) { |
|
43 | - return self::$repo . Sensei()->version . '/packages/' . $locale . '.zip'; |
|
42 | + public static function get_package_uri($locale) { |
|
43 | + return self::$repo.Sensei()->version.'/packages/'.$locale.'.zip'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - protected static function get_settings_uri( $action ) { |
|
54 | - return wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=' . $action ), 'language_pack', '_sensei_language_nonce' ); |
|
53 | + protected static function get_settings_uri($action) { |
|
54 | + return wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action='.$action), 'language_pack', '_sensei_language_nonce'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return string |
61 | 61 | */ |
62 | 62 | public static function get_install_uri() { |
63 | - return self::get_settings_uri( 'language_pack_install' ); |
|
63 | + return self::get_settings_uri('language_pack_install'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | */ |
71 | 71 | public static function get_dismiss_uri() { |
72 | - return self::get_settings_uri( 'dismiss_language_pack_notice' ); |
|
72 | + return self::get_settings_uri('dismiss_language_pack_notice'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @param string $old |
79 | 79 | * @param string $new |
80 | 80 | */ |
81 | - public function updated_language_option( $old, $new ) { |
|
82 | - self::has_language_pack_available( $new ); |
|
81 | + public function updated_language_option($old, $new) { |
|
82 | + self::has_language_pack_available($new); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,42 +89,42 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public static function has_language_pack_available( $locale = null ) { |
|
92 | + public static function has_language_pack_available($locale = null) { |
|
93 | 93 | |
94 | - if ( is_null( $locale ) ) { |
|
94 | + if (is_null($locale)) { |
|
95 | 95 | |
96 | 96 | $locale = get_locale(); |
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - if ( 'en_US' === $locale ) { |
|
100 | + if ('en_US' === $locale) { |
|
101 | 101 | |
102 | 102 | return false; |
103 | 103 | |
104 | 104 | } |
105 | 105 | |
106 | - if ( 'yes' === get_option( 'sensei_needs_language_pack_install' ) ) { |
|
106 | + if ('yes' === get_option('sensei_needs_language_pack_install')) { |
|
107 | 107 | |
108 | 108 | return true; |
109 | 109 | |
110 | 110 | } |
111 | 111 | |
112 | - if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
112 | + if (isset($_GET['translation_updated']) && 5 == $_GET['translation_updated']) { |
|
113 | 113 | |
114 | 114 | return false; |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | - $version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) ); |
|
118 | + $version = get_option('woothemes_sensei_language_pack_version', array('0', $locale)); |
|
119 | 119 | |
120 | - if ( ! is_array( $version ) || version_compare( $version[0], Sensei()->version, '<' ) || $version[1] !== $locale ) { |
|
121 | - if ( self::check_if_language_pack_exists( $locale ) ) { |
|
122 | - update_option( 'sensei_needs_language_pack_install', 'yes' ); |
|
120 | + if ( ! is_array($version) || version_compare($version[0], Sensei()->version, '<') || $version[1] !== $locale) { |
|
121 | + if (self::check_if_language_pack_exists($locale)) { |
|
122 | + update_option('sensei_needs_language_pack_install', 'yes'); |
|
123 | 123 | |
124 | 124 | return true; |
125 | 125 | } else { |
126 | 126 | // Updated the woothemes_sensei_language_pack_version to avoid searching translations for this release again |
127 | - self::update_language_pack_version( $locale ); |
|
127 | + self::update_language_pack_version($locale); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return bool |
139 | 139 | */ |
140 | - public static function check_if_language_pack_exists( $locale ) { |
|
141 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
140 | + public static function check_if_language_pack_exists($locale) { |
|
141 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
142 | 142 | |
143 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
143 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
144 | 144 | return true; |
145 | 145 | } else { |
146 | 146 | return false; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @param string $locale |
154 | 154 | */ |
155 | - public static function update_language_pack_version( $locale ) { |
|
155 | + public static function update_language_pack_version($locale) { |
|
156 | 156 | // Update the language pack version |
157 | - update_option( 'woothemes_sensei_language_pack_version', array( Sensei()->version, $locale ) ); |
|
157 | + update_option('woothemes_sensei_language_pack_version', array(Sensei()->version, $locale)); |
|
158 | 158 | |
159 | 159 | // Remove the translation upgrade notice |
160 | - update_option( 'sensei_needs_language_pack_install', 'no' ); |
|
160 | + update_option('sensei_needs_language_pack_install', 'no'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | public function language_package_actions() { |
167 | 167 | if ( |
168 | 168 | is_admin() |
169 | - && current_user_can( 'update_plugins' ) |
|
170 | - && isset( $_GET['page'] ) |
|
169 | + && current_user_can('update_plugins') |
|
170 | + && isset($_GET['page']) |
|
171 | 171 | && 'woothemes-sensei-settings' === $_GET['page'] |
172 | - && isset( $_GET['action'] ) |
|
172 | + && isset($_GET['action']) |
|
173 | 173 | ) { |
174 | 174 | |
175 | - if ( 'language_pack_install' === $_GET['action'] ) { |
|
175 | + if ('language_pack_install' === $_GET['action']) { |
|
176 | 176 | $this->language_pack_install(); |
177 | 177 | } |
178 | 178 | |
179 | - if ( 'dismiss_language_pack_notice' ) { |
|
179 | + if ('dismiss_language_pack_notice') { |
|
180 | 180 | $this->dismiss_language_pack_notice(); |
181 | 181 | } |
182 | 182 | } |
@@ -186,66 +186,66 @@ discard block |
||
186 | 186 | * Install language pack. |
187 | 187 | */ |
188 | 188 | protected function language_pack_install() { |
189 | - $url = wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=language_pack_install' ), 'language_install' ); |
|
190 | - $settings_url = admin_url( 'admin.php?page=woothemes-sensei-settings' ); |
|
189 | + $url = wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action=language_pack_install'), 'language_install'); |
|
190 | + $settings_url = admin_url('admin.php?page=woothemes-sensei-settings'); |
|
191 | 191 | $locale = get_locale(); |
192 | 192 | |
193 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
194 | - wp_redirect( add_query_arg( array( 'translation_updated' => 2 ), $settings_url ) ); |
|
193 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
194 | + wp_redirect(add_query_arg(array('translation_updated' => 2), $settings_url)); |
|
195 | 195 | exit; |
196 | 196 | } |
197 | 197 | |
198 | - if ( 'en_US' === $locale || ! self::check_if_language_pack_exists( $locale ) ) { |
|
199 | - wp_redirect( add_query_arg( array( 'translation_updated' => 3 ), $settings_url ) ); |
|
198 | + if ('en_US' === $locale || ! self::check_if_language_pack_exists($locale)) { |
|
199 | + wp_redirect(add_query_arg(array('translation_updated' => 3), $settings_url)); |
|
200 | 200 | exit; |
201 | 201 | } |
202 | 202 | |
203 | - if ( false === ( $creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) { |
|
204 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
203 | + if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) { |
|
204 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
205 | 205 | exit; |
206 | 206 | } |
207 | 207 | |
208 | - if ( ! WP_Filesystem( $creds ) ) { |
|
209 | - request_filesystem_credentials( $url, '', true, false, null ); |
|
208 | + if ( ! WP_Filesystem($creds)) { |
|
209 | + request_filesystem_credentials($url, '', true, false, null); |
|
210 | 210 | |
211 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
211 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
212 | 212 | exit; |
213 | 213 | } |
214 | 214 | |
215 | 215 | // Download the language pack |
216 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
217 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
216 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
217 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
218 | 218 | global $wp_filesystem; |
219 | 219 | |
220 | 220 | $upload_dir = wp_upload_dir(); |
221 | - $file = trailingslashit( $upload_dir['path'] ) . $locale . '.zip'; |
|
221 | + $file = trailingslashit($upload_dir['path']).$locale.'.zip'; |
|
222 | 222 | |
223 | 223 | // Save the zip file |
224 | - if ( ! $wp_filesystem->put_contents( $file, $response['body'], FS_CHMOD_FILE ) ) { |
|
225 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
224 | + if ( ! $wp_filesystem->put_contents($file, $response['body'], FS_CHMOD_FILE)) { |
|
225 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | |
229 | 229 | // Unzip the file to wp-content/languages/plugins directory |
230 | - $dir = trailingslashit( WP_LANG_DIR ) . 'plugins/'; |
|
231 | - $unzip = unzip_file( $file, $dir ); |
|
232 | - if ( true !== $unzip ) { |
|
233 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
230 | + $dir = trailingslashit(WP_LANG_DIR).'plugins/'; |
|
231 | + $unzip = unzip_file($file, $dir); |
|
232 | + if (true !== $unzip) { |
|
233 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
234 | 234 | exit; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Delete the package file |
238 | - $wp_filesystem->delete( $file ); |
|
238 | + $wp_filesystem->delete($file); |
|
239 | 239 | |
240 | 240 | // Update version and remove notice |
241 | - self::update_language_pack_version( $locale ); |
|
241 | + self::update_language_pack_version($locale); |
|
242 | 242 | |
243 | 243 | // Redirect and show a success message |
244 | - wp_redirect( add_query_arg( array( 'translation_updated' => 1 ), $settings_url ) ); |
|
244 | + wp_redirect(add_query_arg(array('translation_updated' => 1), $settings_url)); |
|
245 | 245 | exit; |
246 | 246 | } else { |
247 | 247 | // Don't have a valid package for the current language! |
248 | - wp_redirect( add_query_arg( array( 'translation_updated' => 5 ), $settings_url ) ); |
|
248 | + wp_redirect(add_query_arg(array('translation_updated' => 5), $settings_url)); |
|
249 | 249 | exit; |
250 | 250 | } |
251 | 251 | } |
@@ -254,38 +254,38 @@ discard block |
||
254 | 254 | * Hide language pack notice. |
255 | 255 | */ |
256 | 256 | protected function dismiss_language_pack_notice() { |
257 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
258 | - wp_die( __( 'Cheatin’ huh?', 'woothemes-sensei' ) ); |
|
257 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
258 | + wp_die(__('Cheatin’ huh?', 'woothemes-sensei')); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Update version and remove notice |
262 | - self::update_language_pack_version( get_locale() ); |
|
262 | + self::update_language_pack_version(get_locale()); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Language pack messages |
267 | 267 | */ |
268 | 268 | public static function messages() { |
269 | - if ( empty( $_GET['translation_updated'] ) ) { |
|
269 | + if (empty($_GET['translation_updated'])) { |
|
270 | 270 | return; |
271 | 271 | } |
272 | 272 | |
273 | - switch ( $_GET['translation_updated'] ) { |
|
273 | + switch ($_GET['translation_updated']) { |
|
274 | 274 | case 2 : |
275 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Seems you don\'t have permission to do this!', 'woothemes-sensei' ) . '</p></div>'; |
|
275 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Seems you don\'t have permission to do this!', 'woothemes-sensei').'</p></div>'; |
|
276 | 276 | break; |
277 | 277 | case 3 : |
278 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'There is no translation available for your language!', 'woothemes-sensei' ) . '</p></div>'; |
|
278 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('There is no translation available for your language!', 'woothemes-sensei').'</p></div>'; |
|
279 | 279 | break; |
280 | 280 | case 4 : |
281 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . sprintf( __( 'An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei' ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>' ) . '</p></div>'; |
|
281 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.sprintf(__('An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei'), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>').'</p></div>'; |
|
282 | 282 | break; |
283 | 283 | case 5 : |
284 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Sorry but there is no translation available for your language =/', 'woothemes-sensei' ) . '</p></div>'; |
|
284 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Sorry but there is no translation available for your language =/', 'woothemes-sensei').'</p></div>'; |
|
285 | 285 | break; |
286 | 286 | |
287 | 287 | default : |
288 | - echo '<div class="updated"><p>' . __( 'Translations installed/updated successfully!', 'woothemes-sensei' ) . '</p></div>'; |
|
288 | + echo '<div class="updated"><p>'.__('Translations installed/updated successfully!', 'woothemes-sensei').'</p></div>'; |
|
289 | 289 | break; |
290 | 290 | } |
291 | 291 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | ?> |
13 | 13 | |
14 | -<?php get_sensei_header(); ?> |
|
14 | +<?php get_sensei_header(); ?> |
|
15 | 15 | |
16 | 16 | <article <?php post_class(); ?> > |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @hooked WooThemes_Sensei_Messages::the_title - 20 |
27 | 27 | * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
28 | 28 | */ |
29 | - do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
29 | + do_action('sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | 30 | ?> |
31 | 31 | |
32 | 32 | <section class="entry"> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param integer $message_id |
45 | 45 | */ |
46 | - do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
46 | + do_action('sensei_single_message_content_inside_after', get_the_ID()); |
|
47 | 47 | |
48 | 48 | ?> |
49 | 49 | </article><!-- .post --> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The Template for displaying all single messages. |
|
4 | - * |
|
5 | - * Override this template by copying it to yourtheme/sensei/single-message.php |
|
6 | - * |
|
7 | - * @author Automattic |
|
8 | - * @package Sensei |
|
9 | - * @category Templates |
|
10 | - * @version 1.9.0 |
|
11 | - */ |
|
3 | + * The Template for displaying all single messages. |
|
4 | + * |
|
5 | + * Override this template by copying it to yourtheme/sensei/single-message.php |
|
6 | + * |
|
7 | + * @author Automattic |
|
8 | + * @package Sensei |
|
9 | + * @category Templates |
|
10 | + * @version 1.9.0 |
|
11 | + */ |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <?php get_sensei_header(); ?> |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | <article <?php post_class(); ?> > |
17 | 17 | |
18 | 18 | <?php |
19 | - /** |
|
20 | - * Action inside the single message template before the content |
|
21 | - * |
|
22 | - * @since 1.9.0 |
|
23 | - * |
|
24 | - * @param integer $message_id |
|
25 | - * |
|
26 | - * @hooked WooThemes_Sensei_Messages::the_title - 20 |
|
27 | - * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
|
28 | - */ |
|
29 | - do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | - ?> |
|
19 | + /** |
|
20 | + * Action inside the single message template before the content |
|
21 | + * |
|
22 | + * @since 1.9.0 |
|
23 | + * |
|
24 | + * @param integer $message_id |
|
25 | + * |
|
26 | + * @hooked WooThemes_Sensei_Messages::the_title - 20 |
|
27 | + * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
|
28 | + */ |
|
29 | + do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
30 | + ?> |
|
31 | 31 | |
32 | 32 | <section class="entry"> |
33 | 33 | |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | |
38 | 38 | <?php |
39 | 39 | |
40 | - /** |
|
41 | - * action inside the single message template after the content |
|
42 | - * @since 1.9.0 |
|
43 | - * |
|
44 | - * @param integer $message_id |
|
45 | - */ |
|
46 | - do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
40 | + /** |
|
41 | + * action inside the single message template after the content |
|
42 | + * @since 1.9.0 |
|
43 | + * |
|
44 | + * @param integer $message_id |
|
45 | + */ |
|
46 | + do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
47 | 47 | |
48 | - ?> |
|
48 | + ?> |
|
49 | 49 | </article><!-- .post --> |
50 | 50 | |
51 | 51 | <?php get_sensei_footer(); ?> |