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
AdminTools.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPParsidate\Admin; |
| 4 | |
| 5 | defined( 'ABSPATH' ) || exit; |
| 6 | |
| 7 | class AdminTools { |
| 8 | public const tab = 'tools'; |
| 9 | public const icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><g stroke="#3c3c3c" stroke-width="1.5"><path d="M2 14c0-3.771 0-5.657 1.172-6.828S6.229 6 10 6h4c3.771 0 5.657 0 6.828 1.172S22 10.229 22 14s0 5.657-1.172 6.828S17.771 22 14 22h-4c-3.771 0-5.657 0-6.828-1.172S2 17.771 2 14ZM16 6c0-1.886 0-2.828-.586-3.414S13.886 2 12 2s-2.828 0-3.414.586S8 4.114 8 6"/><path stroke-linejoin="round" d="M10 15H6c-.471 0-.707 0-.854.146C5 15.293 5 15.53 5 16v1c0 .471 0 .707.146.854C5.293 18 5.53 18 6 18h4c.471 0 .707 0 .854-.146C11 17.707 11 17.47 11 17v-1c0-.471 0-.707-.146-.854C10.707 15 10.47 15 10 15Z"/><path stroke-linecap="round" d="M6 6.5V15m0 6.5v-3M18 6.5v15"/></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 | add_filter( 'wp_parsidate_' . self::tab . '_tab_display_notice', '__return_false' ); |
| 18 | add_filter( 'wp_parsidate_' . self::tab . '_tab_content_display_notice', '__return_true' ); |
| 19 | } |
| 20 | |
| 21 | public function addMenu( $menus ) { |
| 22 | $menus[ self::tab ] = array( |
| 23 | 'title' => esc_html__( 'Tools', 'wp-parsidate' ), |
| 24 | 'icon' => self::icon |
| 25 | ); |
| 26 | |
| 27 | return $menus; |
| 28 | } |
| 29 | |
| 30 | public function allSettings( $settings ): array { |
| 31 | $settings[ self::tab ] = $this->settings(); |
| 32 | |
| 33 | return $settings; |
| 34 | } |
| 35 | |
| 36 | public function settings(): array { |
| 37 | if ( self::$settings === null ) { |
| 38 | self::$settings = array( |
| 39 | 'title' => esc_html__( 'Tools settings', 'wp-parsidate' ), |
| 40 | 'desc' => esc_html__( 'Advanced tools', 'wp-parsidate' ), |
| 41 | 'sections' => apply_filters( 'wp_parsidate_' . self::tab . '_settings_sections', [] ) |
| 42 | //'settings' => apply_filters( 'wp_parsidate_' . self::tab . '_settings_options', [] ) |
| 43 | ); |
| 44 | } |
| 45 | |
| 46 | return self::$settings; |
| 47 | } |
| 48 | } |
| 49 |