function add_meta_box() { global $wpdb, $sitepress; $metabox = '<div id="wpml-package-admin-bar-popup" style="display:none;position:fixed;z-index:9002;width:200px;padding:10px;border: 1px solid #8CCEEA;background-color:#FFF">'; $wpml_pt_meta = new WPML_Package_Translation_Metabox($this->package, $wpdb, $sitepress, $this->args); $metabox .= $wpml_pt_meta->get_metabox(); $metabox .= '</div>'; $metabox .= $this->add_js(); // This is required when a new package is created but it doesn't have any translated content yet. // https://onthegosystems.myjetbrains.com/youtrack/issue/wpmlst-556 WPML_Simple_Language_Selector::enqueue_scripts(); echo $metabox; }
final function change_package_lang_ajax() { global $wpdb, $sitepress; if (!$this->verify_ajax_call('wpml_package_nonce')) { die('verification failed'); } $package_id = $_POST['package_id']; $package = new WPML_Package($package_id); $package->set_strings_language($_POST['package_lang']); $package_job = new WPML_Package_TM($package); $package_job->set_language_details($_POST['package_lang']); $args = json_decode(base64_decode($_POST['args'])); $package_metabox = new WPML_Package_Translation_Metabox($package, $wpdb, $sitepress, $args); $response = array('metabox' => $package_metabox->get_metabox_status(), 'lang' => $package_metabox->get_package_language_name()); wp_send_json($response); }
/** * @param $package * @param array $args */ function show_language_selector($package, $args = array()) { global $wpdb, $sitepress; $wpml_pt_meta = new WPML_Package_Translation_Metabox($package, $wpdb, $sitepress, $args); echo $wpml_pt_meta->get_metabox(); }