| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
namespace WP_Syntex\Polylang\Options\Business; |
| 7 |
|
| 8 |
use WP_Error; |
| 9 |
use WP_Syntex\Polylang\Options\Primitive\Abstract_Boolean; |
| 10 |
use WP_Syntex\Polylang\Options\Options; |
| 11 |
|
| 12 |
defined( 'ABSPATH' ) || exit; |
| 13 |
|
| 14 |
/** |
| 15 |
* Class defining the "Remove /language/ in pretty permalinks" boolean option. |
| 16 |
* |
| 17 |
* @since 3.7 |
| 18 |
*/ |
| 19 |
class Rewrite extends Abstract_Boolean { |
| 20 |
/** |
| 21 |
* Returns option key. |
| 22 |
* |
| 23 |
* @since 3.7 |
| 24 |
* |
| 25 |
* @return string |
| 26 |
* |
| 27 |
* @phpstan-return 'rewrite' |
| 28 |
*/ |
| 29 |
public static function key(): string { |
| 30 |
return 'rewrite'; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Returns the default value. |
| 35 |
* |
| 36 |
* @since 3.7 |
| 37 |
* |
| 38 |
* @return bool |
| 39 |
*/ |
| 40 |
protected function get_default() { |
| 41 |
return true; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns the description used in the JSON schema. |
| 46 |
* |
| 47 |
* @since 3.7 |
| 48 |
* |
| 49 |
* @return string |
| 50 |
*/ |
| 51 |
protected function get_description(): string { |
| 52 |
return sprintf( |
| 53 |
/* translators: %1$s is a URL slug: `/language/`. %2$s and %3$s are "true/false" values. */ |
| 54 |
__( 'Remove %1$s in pretty permalinks: %2$s to remove, %3$s to keep.', 'polylang' ), |
| 55 |
'`/language/`', |
| 56 |
'`true`', |
| 57 |
'`false`' |
| 58 |
); |
| 59 |
} |
| 60 |
} |
| 61 |
|