| @@ -39,20 +39,20 @@ | ||
| 39 | 39 | <label> |
| 40 | 40 | <?php |
| 41 | 41 | printf( |
| 42 | 42 | '<input name="force_lang" type="radio" value="0" %s /> %s', |
| 43 | - checked( $this->options['force_lang'], 0, false ), | |
| 43 | + $this->options['force_lang'] ? '' : 'checked="checked"', | |
| 44 | 44 | esc_html__( 'The language is set from content', 'polylang' ) |
| 45 | 45 | ); |
| 46 | 46 | ?> |
| 47 | 47 | </label> |
| 48 | - <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> | |
| 49 | 49 | <label> |
| 50 | 50 | <?php |
| 51 | 51 | printf( |
| 52 | 52 | '<input name="force_lang" type="radio" value="1" %s/> %s', |
| 53 | - checked( $this->options['force_lang'], 1, false ), | |
| 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' ) ) | |
| 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' ) | |
| 55 | 55 | ); |
| 56 | 56 | ?> |
| 57 | 57 | </label> |
| 58 | 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> |
| @@ -59,10 +59,10 @@ | ||
| 59 | 59 | <label> |
| 60 | 60 | <?php |
| 61 | 61 | printf( |
| 62 | 62 | '<input name="force_lang" type="radio" value="2" %s %s/> %s', |
| 63 | - disabled( $this->links_model->using_permalinks, false, false ), | |
| 64 | - checked( $this->options['force_lang'], 2, false ), | |
| 63 | + $this->links_model->using_permalinks ? '' : 'disabled="disabled"', | |
| 64 | + 2 == $this->options['force_lang'] ? 'checked="checked"' : '', | |
| 65 | 65 | esc_html__( 'The language is set from the subdomain name in pretty permalinks', 'polylang' ) |
| 66 | 66 | ); |
| 67 | 67 | ?> |
| 68 | 68 | </label> |
| @@ -70,10 +70,10 @@ | ||
| 70 | 70 | <label> |
| 71 | 71 | <?php |
| 72 | 72 | printf( |
| 73 | 73 | '<input name="force_lang" type="radio" value="3" %s %s/> %s', |
| 74 | - disabled( $this->links_model->using_permalinks, false, false ), | |
| 75 | - checked( $this->options['force_lang'], 3, false ), | |
| 74 | + $this->links_model->using_permalinks ? '' : 'disabled="disabled"', | |
| 75 | + 3 == $this->options['force_lang'] ? 'checked="checked"' : '', | |
| 76 | 76 | esc_html__( 'The language is set from different domains', 'polylang' ) |
| 77 | 77 | ); |
| 78 | 78 | ?> |
| 79 | 79 | </label> |
| @@ -79,15 +79,14 @@ | ||
| 79 | 79 | </label> |
| 80 | 80 | <table id="pll-domains-table" class="form-table" <?php echo 3 == $this->options['force_lang'] ? '' : 'style="display: none;"'; ?>> |
| 81 | 81 | <?php |
| 82 | 82 | foreach ( $this->model->get_languages_list() as $lg ) { |
| 83 | - $url = isset( $this->options['domains'][ $lg->slug ] ) ? $this->options['domains'][ $lg->slug ] : ( $lg->slug == $this->options['default_lang'] ? $this->links_model->home : '' ); | |
| 84 | 83 | printf( |
| 85 | 84 | '<tr><td><label for="pll-domain[%1$s]">%2$s</label></td>' . |
| 86 | 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>', |
| 87 | 86 | esc_attr( $lg->slug ), |
| 88 | 87 | esc_attr( $lg->name ), |
| 89 | - 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 : '' ) ) | |
| 90 | 89 | ); |
| 91 | 90 | } |
| 92 | 91 | ?> |
| 93 | 92 | </table> |
| @@ -104,9 +103,9 @@ | ||
| 104 | 103 | <label> |
| 105 | 104 | <?php |
| 106 | 105 | printf( |
| 107 | 106 | '<input name="hide_default" type="checkbox" value="1" %s /> %s', |
| 108 | - checked( $this->options['hide_default'], 1, false ), | |
| 107 | + $this->options['hide_default'] ? 'checked="checked"' : '', | |
| 109 | 108 | esc_html__( 'Hide URL language information for default language', 'polylang' ) |
| 110 | 109 | ); |
| 111 | 110 | ?> |
| 112 | 111 | </label> |
| @@ -123,10 +122,10 @@ | ||
| 123 | 122 | <label> |
| 124 | 123 | <?php |
| 125 | 124 | printf( |
| 126 | 125 | '<input name="rewrite" type="radio" value="1" %s %s/> %s', |
| 127 | - disabled( $this->links_model->using_permalinks, false, false ), | |
| 128 | - checked( $this->options['rewrite'], 1, false ), | |
| 126 | + $this->links_model->using_permalinks ? '' : 'disabled="disabled"', | |
| 127 | + $this->options['rewrite'] ? 'checked="checked"' : '', | |
| 129 | 128 | esc_html__( 'Remove /language/ in pretty permalinks', 'polylang' ) |
| 130 | 129 | ); |
| 131 | 130 | ?> |
| 132 | 131 | </label> |
| @@ -134,10 +133,10 @@ | ||
| 134 | 133 | <label> |
| 135 | 134 | <?php |
| 136 | 135 | printf( |
| 137 | 136 | '<input name="rewrite" type="radio" value="0" %s %s/> %s', |
| 138 | - disabled( $this->links_model->using_permalinks, false, false ), | |
| 139 | - checked( $this->options['rewrite'], 0, false ), | |
| 137 | + $this->links_model->using_permalinks ? '' : 'disabled="disabled"', | |
| 138 | + $this->options['rewrite'] ? '' : 'checked="checked"', | |
| 140 | 139 | esc_html__( 'Keep /language/ in pretty permalinks', 'polylang' ) |
| 141 | 140 | ); |
| 142 | 141 | ?> |
| 143 | 142 | </label> |
| @@ -155,9 +154,9 @@ | ||
| 155 | 154 | <label> |
| 156 | 155 | <?php |
| 157 | 156 | printf( |
| 158 | 157 | '<input name="redirect_lang" type="checkbox" value="1" %s/> %s', |
| 159 | - checked( $this->options['redirect_lang'], 1, false ), | |
| 158 | + $this->options['redirect_lang'] ? 'checked="checked"' : '', | |
| 160 | 159 | esc_html__( 'The front page url contains the language code instead of the page name or page id', 'polylang' ) |
| 161 | 160 | ); |
| 162 | 161 | ?> |
| 163 | 162 | </label> |
| @@ -222,10 +221,8 @@ | ||
| 222 | 221 | * |
| 223 | 222 | * @param array $options |
| 224 | 223 | */ |
| 225 | 224 | protected function update( $options ) { |
| 226 | - $newoptions = array(); | |
| 227 | - | |
| 228 | 225 | foreach ( array( 'force_lang', 'rewrite' ) as $key ) { |
| 229 | 226 | $newoptions[ $key ] = isset( $options[ $key ] ) ? (int) $options[ $key ] : 0; |
| 230 | 227 | } |
| 231 | 228 | |
| @@ -293,9 +290,9 @@ | ||
| 293 | 290 | 'pll_invalid_domain', |
| 294 | 291 | esc_html( |
| 295 | 292 | sprintf( |
| 296 | 293 | /* translators: %s is an url */ |
| 297 | - __( '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' ), | |
| 298 | 295 | $url |
| 299 | 296 | ) |
| 300 | 297 | ) |
| 301 | 298 | ); |