PluginProbe
Polylang / 3.8.9
Polylang v3.8.9
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 / src / Options / Business / First_Activation.php

First_Activation.php in Polylang 3.8.9, at src/Options/Business/First_Activation.php

87 lines 1.8 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 WP_Syntex\Polylang\Options\Abstract_Option;
9 use WP_Syntex\Polylang\Options\Options;
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Class defining the first activation option.
15 *
16 * @since 3.7
17 */
18 class First_Activation extends Abstract_Option {
19 /**
20 * Returns option key.
21 *
22 * @since 3.7
23 *
24 * @return string
25 *
26 * @phpstan-return 'first_activation'
27 */
28 public static function key(): string {
29 return 'first_activation';
30 }
31
32 /**
33 * Returns the default value.
34 *
35 * @since 3.7
36 *
37 * @return int
38 *
39 * @phpstan-return int<0, max>
40 */
41 protected function get_default() {
42 return time();
43 }
44
45 /**
46 * Returns the JSON schema part specific to this option.
47 *
48 * @since 3.7
49 *
50 * @return array Partial schema.
51 *
52 * @phpstan-return array{type: 'integer', minimum: 0, maximum: int<0, max>, readonly: true}
53 */
54 protected function get_data_structure(): array {
55 return array(
56 'type' => 'integer',
57 'minimum' => 0,
58 'maximum' => PHP_INT_MAX,
59 'readonly' => true,
60 );
61 }
62
63 /**
64 * Returns the description used in the JSON schema.
65 *
66 * @since 3.7
67 *
68 * @return string
69 */
70 protected function get_description(): string {
71 return __( 'Time of first activation of Polylang.', 'polylang' );
72 }
73
74 /**
75 * Adds information to the site health info array.
76 *
77 * @since 3.8
78 *
79 * @param Options $options An instance of the Options class providing additional configuration.
80 *
81 * @return array The updated site health information.
82 */
83 public function get_site_health_info( Options $options ): array { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
84 return $this->format_single_value_for_site_health_info( wp_date( get_option( 'date_format' ), $this->get() ) );
85 }
86 }
87