Convert.php
107 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPParsidate\App\Convert; |
| 4 | |
| 5 | class Convert { |
| 6 | public function __construct() { |
| 7 | new FixNumbers(); |
| 8 | new FixArabic(); |
| 9 | |
| 10 | add_filter( 'wp_parsidate_convert_settings_options', [ $this, 'settings' ] ); |
| 11 | } |
| 12 | |
| 13 | public function settings(): array { |
| 14 | return array( |
| 15 | // Numbers |
| 16 | 'start_grid_persian_numbers' => array( |
| 17 | 'title' => esc_html__( 'Convert numbers to Persian', 'wp-parsidate' ), |
| 18 | 'type' => 'startGrid', |
| 19 | ), |
| 20 | 'conv_number_format_i18n' => array( |
| 21 | 'id' => 'conv_number_format_i18n', |
| 22 | 'title' => esc_html__( 'Numbers', 'wp-parsidate' ), |
| 23 | 'desc' => esc_html__( 'Used in menus, comments, API, media, etc.', 'wp-parsidate' ), |
| 24 | 'type' => 'toggle', |
| 25 | 'default' => false, |
| 26 | 'sanitize' => 'bool' |
| 27 | ), |
| 28 | 'conv_page_title' => array( |
| 29 | 'id' => 'conv_page_title', |
| 30 | 'title' => esc_html__( 'Page title', 'wp-parsidate' ), |
| 31 | 'type' => 'toggle', |
| 32 | 'default' => false, |
| 33 | 'sanitize' => 'bool' |
| 34 | ), |
| 35 | 'conv_title' => array( |
| 36 | 'id' => 'conv_title', |
| 37 | 'title' => esc_html__( 'Post title', 'wp-parsidate' ), |
| 38 | 'type' => 'toggle', |
| 39 | 'default' => false, |
| 40 | 'sanitize' => 'bool' |
| 41 | ), |
| 42 | 'conv_contents' => array( |
| 43 | 'id' => 'conv_contents', |
| 44 | 'title' => esc_html__( 'Post content', 'wp-parsidate' ), |
| 45 | 'type' => 'toggle', |
| 46 | 'default' => false, |
| 47 | 'sanitize' => 'bool' |
| 48 | ), |
| 49 | 'conv_excerpt' => array( |
| 50 | 'id' => 'conv_excerpt', |
| 51 | 'title' => esc_html__( 'Post excerpt', 'wp-parsidate' ), |
| 52 | 'type' => 'toggle', |
| 53 | 'default' => false, |
| 54 | 'sanitize' => 'bool' |
| 55 | ), |
| 56 | 'conv_comments' => array( |
| 57 | 'id' => 'conv_comments', |
| 58 | 'title' => esc_html__( 'Comments text', 'wp-parsidate' ), |
| 59 | 'type' => 'toggle', |
| 60 | 'default' => false, |
| 61 | 'sanitize' => 'bool' |
| 62 | ), |
| 63 | 'conv_comment_count' => array( |
| 64 | 'id' => 'conv_comment_count', |
| 65 | 'title' => esc_html__( 'Comments count', 'wp-parsidate' ), |
| 66 | 'type' => 'toggle', |
| 67 | 'default' => false, |
| 68 | 'sanitize' => 'bool' |
| 69 | ), |
| 70 | 'conv_dates' => array( |
| 71 | 'id' => 'conv_dates', |
| 72 | 'title' => esc_html__( 'Dates', 'wp-parsidate' ), |
| 73 | 'type' => 'toggle', |
| 74 | 'default' => false, |
| 75 | 'sanitize' => 'bool' |
| 76 | ), |
| 77 | 'conv_cats' => array( |
| 78 | 'id' => 'conv_cats', |
| 79 | 'title' => esc_html__( 'Categories', 'wp-parsidate' ), |
| 80 | 'type' => 'toggle', |
| 81 | 'default' => false, |
| 82 | 'sanitize' => 'bool' |
| 83 | ), |
| 84 | 'end_grid_persian_numbers' => array( |
| 85 | 'type' => 'endGrid', |
| 86 | ), |
| 87 | |
| 88 | // Letters |
| 89 | 'start_grid_letters' => array( |
| 90 | 'title' => esc_html__( 'Letters', 'wp-parsidate' ), |
| 91 | 'type' => 'startGrid', |
| 92 | ), |
| 93 | 'conv_arabic' => array( |
| 94 | 'id' => 'conv_arabic', |
| 95 | 'title' => esc_html__( 'Fix arabic characters', 'wp-parsidate' ), |
| 96 | 'type' => 'toggle', |
| 97 | 'default' => false, |
| 98 | 'desc' => esc_html__( 'Fixes arabic characters caused by wrong keyboard layouts', 'wp-parsidate' ), |
| 99 | 'sanitize' => 'bool' |
| 100 | ), |
| 101 | 'end_grid_letters' => array( |
| 102 | 'type' => 'endGrid', |
| 103 | ), |
| 104 | ); |
| 105 | } |
| 106 | } |
| 107 |