Admin.php
3 weeks ago
AdminAbout.php
3 weeks ago
AdminAssets.php
3 weeks ago
AdminConvert.php
3 weeks ago
AdminCore.php
3 weeks ago
AdminDashboard.php
3 weeks ago
AdminIntegration.php
3 weeks ago
AdminPages.php
3 weeks ago
AdminSettings.php
3 weeks ago
AdminTools.php
3 weeks ago
AdminConvert.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPParsidate\Admin; |
| 4 | |
| 5 | defined( 'ABSPATH' ) || exit; |
| 6 | |
| 7 | class AdminConvert { |
| 8 | public const tab = 'convert'; |
| 9 | public const icon = '<svg viewBox="0 0 24 24" width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" transform="matrix(1, 0, 0, 1, 0, 0)rotate(90)"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M10 22C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 18.7712 2 15" stroke="#3c3c3c" stroke-width="1.5" stroke-linecap="round"></path> <path d="M22 15C22 18.7712 22 19.6569 20.8284 20.8284C19.6569 22 17.7712 22 14 22" stroke="#3c3c3c" stroke-width="1.5" stroke-linecap="round"></path> <path d="M14 2C17.7712 2 19.6569 2 20.8284 3.17157C22 4.34315 22 5.22876 22 9" stroke="#3c3c3c" stroke-width="1.5" stroke-linecap="round"></path> <path d="M10 2C6.22876 2 4.34315 2 3.17157 3.17157C2 4.34315 2 5.22876 2 9" stroke="#3c3c3c" stroke-width="1.5" stroke-linecap="round"></path> <path d="M2 12H22" stroke="#3c3c3c" stroke-width="1.5" stroke-linecap="round"></path> </g></svg>'; |
| 10 | |
| 11 | private static ?array $settings = null; |
| 12 | |
| 13 | public function __construct() { |
| 14 | add_filter( 'wp_parsidate_menus', [ $this, 'addMenu' ] ); |
| 15 | add_filter( 'wp_parsidate_' . self::tab . '_settings', [ $this, 'settings' ] ); |
| 16 | add_filter( 'wp_parsidate_settings', [ $this, 'allSettings' ] ); |
| 17 | } |
| 18 | |
| 19 | public function addMenu( $menus ) { |
| 20 | $menus[ self::tab ] = array( |
| 21 | 'title' => esc_html__( 'Convert', 'wp-parsidate' ), |
| 22 | 'icon' => self::icon |
| 23 | ); |
| 24 | |
| 25 | return $menus; |
| 26 | } |
| 27 | |
| 28 | public function allSettings( $settings ): array { |
| 29 | $settings[ self::tab ] = $this->settings(); |
| 30 | |
| 31 | return $settings; |
| 32 | } |
| 33 | |
| 34 | public function settings(): array { |
| 35 | if ( self::$settings === null ) { |
| 36 | self::$settings = array( |
| 37 | 'title' => esc_html__( 'Convert settings', 'wp-parsidate' ), |
| 38 | 'desc' => esc_html__( 'Convert Persian letters and numbers', 'wp-parsidate' ), |
| 39 | 'settings' => apply_filters( 'wp_parsidate_' . self::tab . '_settings_options', [] ) |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | return self::$settings; |
| 44 | } |
| 45 | } |
| 46 |