PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
<?php class WPML_TM_Service_Activation_AJAX extends WPML_TM_AJAX_Factory_Obsolete { private $script_handle = 'wpml_tm_service_activation'; private $ignore_local_jobs; /** * @var WPML_Translation_Job_Factory */ private $job_factory; /** * @param WPML_WP_API $wpml_wp_api * @param WPML_Translation_Job_Factory $job_factory */ public function __construct( &$wpml_wp_api, &$job_factory ) { parent::__construct( $wpml_wp_api ); $this->wpml_wp_api = &$wpml_wp_api; $this->job_factory = &$job_factory; $this->add_ajax_action( 'wp_ajax_wpml_cancel_open_local_translators_jobs', array( $this, 'cancel_open_local_translators_jobs' ) ); $this->add_ajax_action( 'wp_ajax_wpml_keep_open_local_translators_jobs', array( $this, 'keep_open_local_translators_jobs' ) ); $this->init(); $this->ignore_local_jobs = get_transient( $this->script_handle . '_ignore_local_jobs' ); if ( $this->ignore_local_jobs == 1 ) { $this->ignore_local_jobs = true; } else { $this->ignore_local_jobs = false; } } public function get_ignore_local_jobs() { return $this->ignore_local_jobs; } public function set_ignore_local_jobs( $value ) { if ( $value == true ) { set_transient( $this->script_handle . '_ignore_local_jobs', 1 ); $this->ignore_local_jobs = true; } else { delete_transient( $this->script_handle . '_ignore_local_jobs' ); $this->ignore_local_jobs = false; } } public function cancel_open_local_translators_jobs() { $translation_filter = array( 'service' => 'local', 'translator' => 0, 'status__not' => ICL_TM_COMPLETE, ); $translation_jobs = $this->job_factory->get_translation_jobs( $translation_filter, true, true ); $jobs_count = count( $translation_jobs ); $deleted = 0; if ( $jobs_count ) { foreach ( $translation_jobs as $job ) { /** @var WPML_Translation_Job $job */ if ( $job && $job->cancel() ) { $deleted += 1; } } } $this->set_ignore_local_jobs( false ); return $this->wpml_wp_api->wp_send_json_success( array( 'opens' => $jobs_count - $deleted, 'cancelled' => $deleted, ) ); } public function keep_open_local_translators_jobs() { $this->set_ignore_local_jobs( true ); return $this->wpml_wp_api->wp_send_json_success( 'Ok!' ); } public function register_resources() { wp_register_script( $this->script_handle, WPML_TM_URL . '/res/js/service-activation.js', array( 'jquery', 'jquery-ui-dialog', 'underscore' ), false, true ); } public function enqueue_resources( $hook_suffix ) { $this->register_resources(); $strings = array( 'alertTitle' => _x( 'Incomplete local translation jobs', 'Incomplete local jobs after TS activation: [response] 00 Title', 'wpml-translation-management' ), 'cancelledJobs' => _x( 'Cancelled local translation jobs:', 'Incomplete local jobs after TS activation: [response] 01 Cancelled', 'wpml-translation-management' ), 'openJobs' => _x( 'Open local translation jobs:', 'Incomplete local jobs after TS activation: [response] 02 Open', 'wpml-translation-management' ), 'errorCancellingJobs' => _x( 'Unable to cancel some or all jobs', 'Incomplete local jobs after TS activation: [response] 03 Error', 'wpml-translation-management' ), 'errorGeneric' => _x( 'Unable to complete the action', 'Incomplete local jobs after TS activation: [response] 04 Error', 'wpml-translation-management' ), 'keepLocalJobs' => _x( 'Local translation jobs will be kept and the above notice hidden.', 'Incomplete local jobs after TS activation: [response] 10 Close button', 'wpml-translation-management' ), 'closeButton' => _x( 'Close', 'Incomplete local jobs after TS activation: [response] 20 Close button', 'wpml-translation-management' ), 'confirm' => _x( 'Are you sure you want to do this?', 'Incomplete local jobs after TS activation: [confirmation] 01 Message', 'wpml-translation-management' ), 'yes' => _x( 'Yes', 'Incomplete local jobs after TS activation: [confirmation] 01 Yes', 'wpml-translation-management' ), 'no' => _x( 'No', 'Incomplete local jobs after TS activation: [confirmation] 01 No', 'wpml-translation-management' ), ); wp_localize_script( $this->script_handle, $this->script_handle . '_strings', $strings ); wp_enqueue_script( $this->script_handle ); } }
[+]
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