PluginProbe
Polylang / 2.5.2
Polylang v2.5.2
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | settings/settings-url.php +16 -28 2.82.5.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * A class to manage URL modifications settings
8 5 *
@@ -8,14 +5,8 @@
8 5 *
9 6 * @since 1.8
10 7 */
11 8 class PLL_Settings_Url extends PLL_Settings_Module {
12 - /**
13 - * Stores the display order priority.
14 - *
15 - * @var int
16 - */
17 - public $priority = 10;
18 9
19 10 /**
20 11 * Constructor
21 12 *
@@ -48,20 +39,20 @@
48 39 <label>
49 40 <?php
50 41 printf(
51 42 '<input name="force_lang" type="radio" value="0" %s /> %s',
52 - checked( $this->options['force_lang'], 0, false ),
43 + $this->options['force_lang'] ? '' : 'checked="checked"',
53 44 esc_html__( 'The language is set from content', 'polylang' )
54 45 );
55 46 ?>
56 47 </label>
57 - <p class="description"><?php esc_html_e( 'Posts, pages, categories and tags URLs will not be modified.', 'polylang' ); ?></p>
48 + <p class="description"><?php esc_html_e( 'Posts, pages, categories and tags urls are not modified.', 'polylang' ); ?></p>
58 49 <label>
59 50 <?php
60 51 printf(
61 52 '<input name="force_lang" type="radio" value="1" %s/> %s',
62 - checked( $this->options['force_lang'], 1, false ),
63 - ( $this->links_model->using_permalinks ? esc_html__( 'The language is set from the directory name in pretty permalinks', 'polylang' ) : esc_html__( 'The language is set from the code in the URL', 'polylang' ) )
53 + 1 == $this->options['force_lang'] ? 'checked="checked"' : '',
54 + $this->links_model->using_permalinks ? esc_html__( 'The language is set from the directory name in pretty permalinks', 'polylang' ) : esc_html__( 'The language is set from the code in the URL', 'polylang' )
64 55 );
65 56 ?>
66 57 </label>
67 58 <p class="description"><?php echo esc_html__( 'Example:', 'polylang' ) . ' <code>' . esc_html( home_url( $this->links_model->using_permalinks ? 'en/my-post/' : '?lang=en&p=1' ) ) . '</code>'; ?></p>
@@ -68,10 +59,10 @@
68 59 <label>
69 60 <?php
70 61 printf(
71 62 '<input name="force_lang" type="radio" value="2" %s %s/> %s',
72 - disabled( $this->links_model->using_permalinks, false, false ),
73 - checked( $this->options['force_lang'], 2, false ),
63 + $this->links_model->using_permalinks ? '' : 'disabled="disabled"',
64 + 2 == $this->options['force_lang'] ? 'checked="checked"' : '',
74 65 esc_html__( 'The language is set from the subdomain name in pretty permalinks', 'polylang' )
75 66 );
76 67 ?>
77 68 </label>
@@ -79,10 +70,10 @@
79 70 <label>
80 71 <?php
81 72 printf(
82 73 '<input name="force_lang" type="radio" value="3" %s %s/> %s',
83 - disabled( $this->links_model->using_permalinks, false, false ),
84 - checked( $this->options['force_lang'], 3, false ),
74 + $this->links_model->using_permalinks ? '' : 'disabled="disabled"',
75 + 3 == $this->options['force_lang'] ? 'checked="checked"' : '',
85 76 esc_html__( 'The language is set from different domains', 'polylang' )
86 77 );
87 78 ?>
88 79 </label>
@@ -88,15 +79,14 @@
88 79 </label>
89 80 <table id="pll-domains-table" class="form-table" <?php echo 3 == $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>>
90 81 <?php
91 82 foreach ( $this->model->get_languages_list() as $lg ) {
92 - $url = isset( $this->options['domains'][ $lg->slug ] ) ? $this->options['domains'][ $lg->slug ] : ( $lg->slug == $this->options['default_lang'] ? $this->links_model->home : '' );
93 83 printf(
94 84 '<tr><td><label for="pll-domain[%1$s]">%2$s</label></td>' .
95 85 '<td><input name="domains[%1$s]" id="pll-domain[%1$s]" type="text" value="%3$s" class="regular-text code" aria-required="true" /></td></tr>',
96 86 esc_attr( $lg->slug ),
97 87 esc_attr( $lg->name ),
98 - esc_url( $url )
88 + esc_url( isset( $this->options['domains'][ $lg->slug ] ) ? $this->options['domains'][ $lg->slug ] : ( $lg->slug == $this->options['default_lang'] ? $this->links_model->home : '' ) )
99 89 );
100 90 }
101 91 ?>
102 92 </table>
@@ -113,9 +103,9 @@
113 103 <label>
114 104 <?php
115 105 printf(
116 106 '<input name="hide_default" type="checkbox" value="1" %s /> %s',
117 - checked( $this->options['hide_default'], 1, false ),
107 + $this->options['hide_default'] ? 'checked="checked"' : '',
118 108 esc_html__( 'Hide URL language information for default language', 'polylang' )
119 109 );
120 110 ?>
121 111 </label>
@@ -132,10 +122,10 @@
132 122 <label>
133 123 <?php
134 124 printf(
135 125 '<input name="rewrite" type="radio" value="1" %s %s/> %s',
136 - disabled( $this->links_model->using_permalinks, false, false ),
137 - checked( $this->options['rewrite'], 1, false ),
126 + $this->links_model->using_permalinks ? '' : 'disabled="disabled"',
127 + $this->options['rewrite'] ? 'checked="checked"' : '',
138 128 esc_html__( 'Remove /language/ in pretty permalinks', 'polylang' )
139 129 );
140 130 ?>
141 131 </label>
@@ -143,10 +133,10 @@
143 133 <label>
144 134 <?php
145 135 printf(
146 136 '<input name="rewrite" type="radio" value="0" %s %s/> %s',
147 - disabled( $this->links_model->using_permalinks, false, false ),
148 - checked( $this->options['rewrite'], 0, false ),
137 + $this->links_model->using_permalinks ? '' : 'disabled="disabled"',
138 + $this->options['rewrite'] ? '' : 'checked="checked"',
149 139 esc_html__( 'Keep /language/ in pretty permalinks', 'polylang' )
150 140 );
151 141 ?>
152 142 </label>
@@ -164,9 +154,9 @@
164 154 <label>
165 155 <?php
166 156 printf(
167 157 '<input name="redirect_lang" type="checkbox" value="1" %s/> %s',
168 - checked( $this->options['redirect_lang'], 1, false ),
158 + $this->options['redirect_lang'] ? 'checked="checked"' : '',
169 159 esc_html__( 'The front page url contains the language code instead of the page name or page id', 'polylang' )
170 160 );
171 161 ?>
172 162 </label>
@@ -231,10 +221,8 @@
231 221 *
232 222 * @param array $options
233 223 */
234 224 protected function update( $options ) {
235 - $newoptions = array();
236 -
237 225 foreach ( array( 'force_lang', 'rewrite' ) as $key ) {
238 226 $newoptions[ $key ] = isset( $options[ $key ] ) ? (int) $options[ $key ] : 0;
239 227 }
240 228
@@ -302,9 +290,9 @@
302 290 'pll_invalid_domain',
303 291 esc_html(
304 292 sprintf(
305 293 /* translators: %s is an url */
306 - __( 'Polylang was unable to access the %s URL. Please check that the URL is valid.', 'polylang' ),
294 + __( 'Polylang was unable to access the URL %s. Please check that the URL is valid.', 'polylang' ),
307 295 $url
308 296 )
309 297 )
310 298 );