PluginProbe
Polylang / 3.7
Polylang v3.7
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / include / Options / Business / Sync.php

Sync.php in Polylang 3.7, at include/Options/Business/Sync.php

69 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 namespace WP_Syntex\Polylang\Options\Business;
7
8 use NOOP_Translations;
9 use PLL_Settings_Sync;
10 use WP_Syntex\Polylang\Options\Primitive\Abstract_List;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Class defining synchronization settings list option.
16 *
17 * @since 3.7
18 *
19 * @phpstan-import-type SchemaType from \WP_Syntex\Polylang\Options\Abstract_Option
20 */
21 class Sync extends Abstract_List {
22 /**
23 * Returns option key.
24 *
25 * @since 3.7
26 *
27 * @return string
28 *
29 * @phpstan-return 'sync'
30 */
31 public static function key(): string {
32 return 'sync';
33 }
34
35 /**
36 * Returns the JSON schema part specific to this option.
37 *
38 * @since 3.7
39 *
40 * @return array Partial schema.
41 *
42 * @phpstan-return array{type: 'array', items: array{type: SchemaType, enum: non-empty-list<non-falsy-string>}}
43 */
44 protected function get_data_structure(): array {
45 $GLOBALS['l10n']['polylang'] = new NOOP_Translations(); // Prevents loading the translations too early.
46 $enum = array_keys( PLL_Settings_Sync::list_metas_to_sync() );
47 unset( $GLOBALS['l10n']['polylang'] );
48
49 return array(
50 'type' => 'array',
51 'items' => array(
52 'type' => $this->get_type(),
53 'enum' => $enum,
54 ),
55 );
56 }
57
58 /**
59 * Returns the description used in the JSON schema.
60 *
61 * @since 3.7
62 *
63 * @return string
64 */
65 protected function get_description(): string {
66 return __( 'List of data to synchronize.', 'polylang' );
67 }
68 }
69