| Server IP : 146.190.157.162 / Your IP : 216.73.216.213 Web Server : Apache System : Linux ubuntu-s-2vcpu-4gb-amd-sfo3-01-KIT-DIGITAL 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64 User : businessweek ( 639) PHP Version : 8.2.10-2ubuntu2.2 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_signal,pcntl_signal_dispatch,pcntl_getpriority,pcntl_setpriority,dl,putenv,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/luzzani22/wp-content/plugins/polylang/modules/sync/ |
Upload File : |
<?php
/**
* @package Polylang
*/
/**
* Settings class for synchronization settings management
*
* @since 1.8
*/
class PLL_Settings_Sync extends PLL_Settings_Module {
/**
* Stores the display order priority.
*
* @var int
*/
public $priority = 50;
/**
* Constructor
*
* @since 1.8
*
* @param object $polylang The polylang object.
*/
public function __construct( &$polylang ) {
parent::__construct(
$polylang,
array(
'module' => 'sync',
'title' => __( 'Synchronization', 'polylang' ),
'description' => __( 'The synchronization options allow to maintain exact same values (or translations in the case of taxonomies and page parent) of meta content between the translations of a post or page.', 'polylang' ),
)
);
}
/**
* Deactivates the module
*
* @since 1.8
*/
public function deactivate() {
$this->options['sync'] = array();
}
/**
* Displays the settings form
*
* @since 1.8
*/
protected function form() {
?>
<ul class="pll-inline-block-list">
<?php
foreach ( self::list_metas_to_sync() as $key => $str ) {
printf(
'<li><label><input name="sync[%s]" type="checkbox" value="1" %s /> %s</label></li>',
esc_attr( $key ),
checked( in_array( $key, $this->options['sync'] ), true, false ),
esc_html( $str )
);
}
?>
</ul>
<?php
}
/**
* Prepare the received data before saving.
*
* @since 3.7
*
* @param array $options Raw values to save.
* @return array
*/
protected function prepare_raw_data( array $options ): array {
// Take care to return only validated options.
return array( 'sync' => empty( $options['sync'] ) ? array() : array_keys( $options['sync'], 1 ) );
}
/**
* Get the row actions.
*
* @since 1.8
*
* @return string[] Row actions.
*/
protected function get_actions() {
return empty( $this->options['sync'] ) ? array( 'configure' ) : array( 'configure', 'deactivate' );
}
/**
* Get the list of synchronization settings.
*
* @since 1.0
*
* @return string[] Array synchronization options.
*
* @phpstan-return non-empty-array<non-falsy-string, string>
*/
public static function list_metas_to_sync() {
return array(
'taxonomies' => __( 'Taxonomies', 'polylang' ),
'post_meta' => __( 'Custom fields', 'polylang' ),
'comment_status' => __( 'Comment status', 'polylang' ),
'ping_status' => __( 'Ping status', 'polylang' ),
'sticky_posts' => __( 'Sticky posts', 'polylang' ),
'post_date' => __( 'Published date', 'polylang' ),
'post_format' => __( 'Post format', 'polylang' ),
'post_parent' => __( 'Page parent', 'polylang' ),
'_wp_page_template' => __( 'Page template', 'polylang' ),
'menu_order' => __( 'Page order', 'polylang' ),
'_thumbnail_id' => __( 'Featured image', 'polylang' ),
);
}
}