public function updated_job_status_with_log($args, $bypass_auth = false) { WPML_TranslationProxy_Com_Log::log_xml_rpc(array('tp_job_id' => $args[0], 'cms_id' => $args[1], 'status' => $args[2], 'signature' => 'UNDISCLOSED')); $args[3] = $bypass_auth ? true : $args[3]; $ret = 'Project does not exist'; if ($this->project) { $ret = $this->update_status($args, $bypass_auth); } WPML_TranslationProxy_Com_Log::log_xml_rpc(array('result' => $ret)); return $ret; }
public function build_tp_com_log() { if (isset($_POST['tp-com-clear-log'])) { WPML_TranslationProxy_Com_Log::clear_log(); } if (isset($_POST['tp-com-disable-log'])) { WPML_TranslationProxy_Com_Log::set_logging_state(false); } if (isset($_POST['tp-com-enable-log'])) { WPML_TranslationProxy_Com_Log::set_logging_state(true); } $action_url = esc_attr('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=' . $_GET['sm']); $com_log = WPML_TranslationProxy_Com_Log::get_log(); ?> <form method="post" id="tp-com-log-form" name="tp-com-log-form" action="<?php echo $action_url; ?> "> <?php if (WPML_TranslationProxy_Com_Log::is_logging_enabled()) { ?> <?php _e("This is a log of the communication between your site and the translation system. It doesn't include any private information and allows WPML support to help with problems related to sending content to translation.", 'wpml-translation-management'); ?> <br /> <br /> <?php if ($com_log != '') { ?> <textarea wrap="off" readonly="readonly" rows="16" style="font-size:10px; width:100%"><?php echo $com_log; ?> </textarea> <br /> <br /> <input class="button-secondary" type="submit" name="tp-com-clear-log" value="<?php _e('Clear log', 'wpml-translation-management'); ?> "> <?php } else { ?> <strong><?php _e('The communication log is empty.', 'wpml-translation-management'); ?> </strong> <br /> <br /> <?php } ?> <input class="button-secondary" type="submit" name="tp-com-disable-log" value="<?php _e('Disable logging', 'wpml-translation-management'); ?> "> <?php } else { ?> <?php _e("Communication logging is currently disabled. To allow WPML support to help you with issues related to sending content to translation, you need to enable the communication logging.", 'wpml-translation-management'); ?> <br /> <br /> <input class="button-secondary" type="submit" name="tp-com-enable-log" value="<?php _e('Enable logging', 'wpml-translation-management'); ?> "> <?php } ?> </form> <?php }
public function add_com_log_link() { WPML_TranslationProxy_Com_Log::add_com_log_link(); }
public function __construct($message) { WPML_TranslationProxy_Com_Log::log_error($message); parent::__construct($message); }
/** * @param string $url * @param array $params * @param string $method * @param bool $has_return_value * * @throws RuntimeException * * @return null|string */ private function call_remote_api($url, $params, $method, $has_return_value = true) { $context = $this->filter_request_params($params, $method); $response = $this->http->request($url, $context); if (is_wp_error($response) || $has_return_value && (bool) $response === false || isset($response['response']['code']) && $response['response']['code'] > 400) { $sanitized_context = WPML_TranslationProxy_Com_Log::sanitize_data($context); $sanitized_response = WPML_TranslationProxy_Com_Log::sanitize_data($response); throw new RuntimeException('Cannot communicate with the remote service params: `' . serialize($sanitized_context) . '` response: `' . serialize($sanitized_response) . '`'); } return $response; }