Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<?php
/**
* @package Polylang
*/

namespace WP_Syntex\Polylang_Pro\Options\Business;

use WP_Syntex\Polylang\Options\Primitive\Abstract_Boolean;

defined( 'ABSPATH' ) || exit;
defined('ABSPATH') || exit;

/**
* Class defining machine translation boolean option.
*
* @since 3.7
*/
class Machine_Translation_Enabled extends Abstract_Boolean {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_enabled'
*/
public static function key(): string {
return 'machine_translation_enabled';
}
class Machine_Translation_Enabled extends Abstract_Boolean
{
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_enabled'
*/
public static function key(): string
{
return 'machine_translation_enabled';
}

/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Enable machine translation.', 'polylang-pro' );
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string
{
return __('Enable machine translation.', 'polylang-pro');
}
}
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
<?php
/**
* @package Polylang
*/

namespace WP_Syntex\Polylang_Pro\Options\Business;

use WP_Syntex\Polylang\Options\Abstract_Option;
use WP_Syntex\Polylang_Pro\Modules\Machine_Translation\Factory;

defined( 'ABSPATH' ) || exit;
defined('ABSPATH') || exit;

/**
* Class defining machine translation services array option.
*
* @since 3.7
*/
class Machine_Translation_Services extends Abstract_Option {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_services'
*/
public static function key(): string {
return 'machine_translation_services';
}
class Machine_Translation_Services extends Abstract_Option
{
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_services'
*/
public static function key(): string
{
return 'machine_translation_services';
}

/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default() {
$services = array();
/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default()
{
$services = [];

foreach ( Factory::get_classnames() as $service ) {
$services[ $service::get_slug() ] = array();
}
foreach (Factory::get_classnames() as $service) {
$services[$service::get_slug()] = [];
}

return $services;
}
return $services;
}

/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array<
* non-falsy-string,
* array{
* type: 'object',
* properties: array,
* additionalProperties: false
* }
* >,
* additionalProperties: false
* }
*/
protected function get_data_structure(): array {
$structure = array(
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => array(),
'additionalProperties' => false,
);
/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array<
* non-falsy-string,
* array{
* type: 'object',
* properties: array,
* additionalProperties: false
* }
* >,
* additionalProperties: false
* }
*/
protected function get_data_structure(): array
{
$structure = [
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => [],
'additionalProperties' => false,
];

foreach ( Factory::get_classnames() as $service ) {
$structure['properties'][ $service::get_slug() ] = array(
'type' => 'object',
'properties' => $service::get_option_schema(),
'additionalProperties' => false,
);
}
foreach (Factory::get_classnames() as $service) {
$structure['properties'][$service::get_slug()] = [
'type' => 'object',
'properties' => $service::get_option_schema(),
'additionalProperties' => false,
];
}

return $structure;
}
return $structure;
}

/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Settings for machine translation services: DeepL\'s API key and formality for now.', 'polylang-pro' );
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string
{
return __('Settings for machine translation services: DeepL\'s API key and formality for now.', 'polylang-pro');
}
}
136 changes: 69 additions & 67 deletions __plugins/polylang-pro-3.7.6/include/Options/Business/Media.php
Original file line number Diff line number Diff line change
@@ -1,83 +1,85 @@
<?php
/**
* @package Polylang
*/

namespace WP_Syntex\Polylang_Pro\Options\Business;

use WP_Syntex\Polylang\Options\Abstract_Option;

defined( 'ABSPATH' ) || exit;
defined('ABSPATH') || exit;

/**
* Class defining media array option.
*
* @since 3.7
*/
class Media extends Abstract_Option {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'media'
*/
public static function key(): string {
return 'media';
}
class Media extends Abstract_Option
{
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'media'
*/
public static function key(): string
{
return 'media';
}

/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default() {
return array( 'duplicate' => false );
}
/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default()
{
return ['duplicate' => false];
}

/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array{
* duplicate: array{
* type: 'boolean',
* required: true
* }
* },
* additionalProperties: false
* }
*/
protected function get_data_structure(): array {
return array(
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => array(
'duplicate' => array(
'type' => 'boolean',
'required' => true,
),
),
'additionalProperties' => false,
);
}
/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array{
* duplicate: array{
* type: 'boolean',
* required: true
* }
* },
* additionalProperties: false
* }
*/
protected function get_data_structure(): array
{
return [
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => [
'duplicate' => [
'type' => 'boolean',
'required' => true,
],
],
'additionalProperties' => false,
];
}

/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Automatically duplicate media in all languages when uploading a new file.', 'polylang-pro' );
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string
{
return __('Automatically duplicate media in all languages when uploading a new file.', 'polylang-pro');
}
}
Loading