PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
<?php class WPML_Translate_Independently { public function __construct() { $this->init(); } public function init() { add_action( 'wpml_scripts_setup', array( $this, 'localize_scripts' ), PHP_INT_MAX ); add_action( 'wp_ajax_check_duplicate', array( $this, 'wpml_translate_independently' ) ); add_filter( 'tiny_mce_before_init', array( $this, 'add_tiny_mce_change_detection' ), 999, 1 ); } public function wpml_translate_independently() { $post_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : null; $nonce = isset( $_POST['icl_duplciate_nonce'] ) ? sanitize_text_field( $_POST['icl_duplciate_nonce'] ) : ''; if ( wp_verify_nonce( $nonce, 'icl_check_duplicates' ) || null === $post_id ) { if ( delete_post_meta( $post_id, '_icl_lang_duplicate_of' ) ) { wp_send_json_success( true ); } else { wp_send_json_error( false ); } } else { wp_send_json_error( false ); } } public function localize_scripts() { $success = _x( 'You are updating a duplicate post.', '1/2 Confirm to make duplicated translations independent', 'sitepress' ) . "\n"; $success .= _x( 'To not lose your changes, WPML will set this post to be translated independently.', '2/2 Confirm to make duplicated translations independent', 'sitepress' ) . "\n"; $duplicate_data = array( 'icl_duplicate_message' => $success, 'icl_duplicate_fail' => __( 'Unable to remove relationship!', 'sitepress' ), ); $post = isset( $_GET['post'] ) ? filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT ) : ''; if ( $post && '' !== get_post_meta( $post, '_icl_lang_duplicate_of', true ) ) { $duplicate_data['duplicate_post_nonce'] = wp_create_nonce( 'icl_check_duplicates' ); $duplicate_data['duplicate_post'] = $post; $duplicate_data['wp_classic_editor_changed'] = false; } wp_localize_script( 'sitepress-post-edit', 'icl_duplicate_data', $duplicate_data ); } /** * Add callback to detect post editor change. * * @param array $initArray * * @return array */ public function add_tiny_mce_change_detection( $initArray ) { $initArray['setup'] = 'function(ed) { ed.on(\'change\', function() { icl_duplicate_data.wp_classic_editor_changed = true; }); }'; return $initArray; } }
[+]
wpml-wp
[+]
ajax
[-] class-wpml-tm-translators-dropdown.php
[edit]
[+]
translation-priorities
[-] class-wpml-tm-promotions.php
[edit]
[+]
hooks
[+]
ICL-20-migration
[+]
templates
[+]
action-filter-loader
[-] class-wpml-translation-proxy-api.php
[edit]
[+]
wpml-st
[+]
utilities
[-] class-wpml-tm-translated-field.php
[edit]
[+]
requirements
[+]
sticky-posts
[-] class-wpml-tm-page.php
[edit]
[+]
icl
[+]
display-as-translated
[+]
custom-field-translation
[+]
language
[+]
ATE
[+]
shortcodes
[+]
translate_link_targets
[+]
core-abstract-classes
[+]
full-site-editing
[+]
settings
[-] class-wpml-file.php
[edit]
[+]
xliff
[+]
reset
[+]
REST-hooks
[+]
comments
[+]
plugins
[+]
templating
[+]
container
[+]
taxonomy
[+]
cookie
[-] class-wpml-tm-requirements.php
[edit]
[+]
translation-dashboard
[+]
helpers
[+]
translation-feedback
[+]
admin-language-switcher
[-] class-wpml-tm-troubleshooting-clear-ts.php
[edit]
[+]
jobs
[+]
compatibility
[+]
wp-core-hooks
[+]
post-edit-screen
[-] class-wpml-tm-troubleshooting-clear-ts-ui.php
[edit]
[+]
translation-jobs
[+]
logging
[+]
roles
[+]
media
[-] class-wpml-active-plugin-provider.php
[edit]
[+]
media-translation
[-] class-wpml-config-update.php
[edit]
[+]
seo
[+]
options
[+]
Installer
[-] class-wpml-tm-ajax-factory-2.php
[edit]
[+]
automatic-translation
[+]
troubleshoot
[+]
records
[-] class-wpml-translate-independently.php
[edit]
[+]
abstract
[-] class-wpml-tm-resources-factory.php
[edit]
[+]
post-types
[+]
wp-cli
[+]
translation-proxy
[-] class-wpml-tm-loader.php
[edit]
[-] class-wpml-config-update-integrator.php
[edit]
[-] class-wpml-theme-localization-type.php
[edit]
[+]
taxonomy-term-translation
[+]
setup
[+]
language-switcher
[+]
translation-mode
[+]
jobs-deadline
[+]
database-queries
[+]
utils
[+]
translation-basket
[-] ISitePress.php
[edit]
[-] class-wpml-current-screen.php
[edit]
[-] class-wpml-tm-ajax-factory.php
[edit]
[+]
admin-bar
[+]
canonicals
[+]
custom-xml-config
[-] class-wpml-db-chunk.php
[edit]
[+]
url-handling
[+]
admin-resources
[+]
theme-plugin-localization
[+]
ui-elements
[+]
languages
[+]
wizard
[-] LanguageNegotiation.php
[edit]
[-] class-wpml-browser-redirect.php
[edit]
[+]
menu
[-] class-wpml-mo-file-search.php
[edit]
[+]
query-filtering
[+]
translation-management
[+]
filters
[-] class-wpml-xmlrpc.php
[edit]
[-] class-wpml-site-id.php
[edit]
[+]
block-editor
[+]
icl-to-ate-migration
[+]
translations
[+]
user-language
[+]
..
[+]
menu-elements
[+]
translation-batch
[-] class-wpml-tm-api.php
[edit]
[-] class-wpml-translation-management.php
[edit]
[-] class-wpml-translation-job-factory.php
[edit]
[+]
xml-config
[+]
REST
[+]
editor
[+]
admin-menu
[+]
localization
[+]
tp-client
[+]
translation-roles
[-] Geolocalization.php
[edit]
[+]
wp
[+]
API
[+]
twig-extensions
[+]
troubleshooting
[+]
privacy
[+]
user
[-] class-wpml-tm-service-activation-ajax.php
[edit]
[+]
widgets
[+]
super-globals
[+]
emails
[+]
words-count
[+]
support
[+]
post-translation
[+]
browser-language-redirect
[+]
request-handling
[+]
notices
[+]
upgrade