HEX
Server: nginx/1.28.1
System: Linux iZgw8b5bpgd4jyptfmmmxgZ 6.6.102-5.2.alnx4.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 27 23:11:10 CST 2025 x86_64
User: www (1000)
PHP: 8.2.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.scdc-marine.com/wp-content/plugins/Polylang-Pro/modules/wizard/wizard-pro.php
<?php
/**
 * @package Polylang-Pro
 */

/**
 * Main class for Polylang Pro wizard.
 *
 * @since 2.7
 */
class PLL_Wizard_Pro {

	/**
	 * @var PLL_Model
	 */
	public $model;

	/**
	 * @var PLL_Sync_Post_Model
	 */
	protected $sync_model;

	/**
	 * Constructor
	 *
	 * @since 2.7
	 *
	 * @param object $polylang Reference to Polylang options array.
	 */
	public function __construct( &$polylang ) {
		$this->model      = &$polylang->model;
		$this->sync_model = &$polylang->sync_post_model;

		// See pll_wizard_create_home_page_translations filter in PLL_Wizard class.
		add_filter( 'pll_wizard_create_home_page_translations', array( $this, 'replace_create_home_page_translations' ) );
	}

	/**
	 * Replace function to apply to process the home page transations creation.
	 *
	 * @since 2.7
	 *
	 * @return callable
	 */
	public function replace_create_home_page_translations() {
		return array( $this, 'create_home_page_translations' );
	}

	/**
	 * Create home page translations for each language defined with duplicating content.
	 *
	 * @since 2.7
	 *
	 * @param string $default_language       slug of the default language; null if no default language is defined.
	 * @param int    $home_page              post_id of the home page if it's defined, false otherwise.
	 * @param string $home_page_title        home page title if it's defined, 'Homepage' otherwise.
	 * @param string $home_page_language     slug of the home page if it's defined, false otherwise.
	 * @param array  $untranslated_languages array of languages which needs to have a home page translated.
	 * @return void
	 */
	public function create_home_page_translations( $default_language, $home_page, $home_page_title, $home_page_language, $untranslated_languages ) {
		global $wpdb;

		foreach ( $untranslated_languages as $language ) {
			$translated_post_id = $this->sync_model->copy_post( $home_page, $language, false );
			$language_properties = $this->model->get_language( $language );
			$wpdb->update(
				$wpdb->posts,
				array( 'post_title' => $home_page_title . ' - ' . $language_properties->name ),
				array( 'ID' => $translated_post_id )
			); // Don't use wp_update_post to ensure not redo save post process.
		}
	}
}