PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.16.6
Translate and Go multilingual – Automatic AI translation – wpLingua v2.16.6
2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 All 111 releases
wplingua / inc / admin / admin.php

admin.php in Translate and Go multilingual – Automatic AI translation – wpLingua 2.16.6, at inc/admin/admin.php

70 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // If this file is called directly, abort.
4 if ( ! defined( 'WPINC' ) ) {
5 die;
6 }
7
8
9 /**
10 * Add a link for edit translations on page and post list
11 *
12 * @param array $actions An array of row action links (string)
13 * @param WP_Post $post The post object
14 * @return array
15 */
16 function wplng_row_edit_translation_link( $actions, $post ) {
17
18 /**
19 * Check the current page
20 */
21
22 if ( 'post' !== $post->post_type && 'page' !== $post->post_type ) {
23 return $actions;
24 }
25
26 /**
27 * Check if a target language is defined
28 */
29
30 $languages_target_ids = wplng_get_languages_target_ids();
31
32 if ( empty( $languages_target_ids[0] ) ) {
33 return $actions;
34 }
35
36 /**
37 * Make the edit translations link
38 */
39
40 $url = get_permalink( $post );
41
42 if ( empty( $url ) || ! wplng_url_is_translatable( $url ) ) {
43 return $actions;
44 }
45
46 $url = add_query_arg(
47 'wplng-mode',
48 'list',
49 wplng_url_translate(
50 $url,
51 $languages_target_ids[0]
52 )
53 );
54
55 $html = '<a';
56 $html .= ' href="' . esc_url( $url ) . '"';
57 $html .= ' aria-label="' . esc_attr__( 'Edit translations', 'wplingua' ) . '"';
58 $html .= '>';
59 $html .= esc_html__( 'Translations', 'wplingua' );
60 $html .= '</a>';
61
62 /**
63 * Add link and return updated actions
64 */
65
66 $actions['wplng-edit-link'] = $html;
67
68 return $actions;
69 }
70