| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/old-website/wp-content/plugins/polylang/admin/ |
Upload File : |
<?php
/**
* Manages links related functions
*
* @since 1.8
*/
class PLL_Admin_Links extends PLL_Links {
/**
* Get the link to create a new post translation
*
* @since 1.5
*
* @param int $post_id the source post id
* @param object $language the language of the new translation
* @return string
*/
public function get_new_post_translation_link( $post_id, $language ) {
$post_type = get_post_type( $post_id );
$post_type_object = get_post_type_object( get_post_type( $post_id ) );
if ( ! current_user_can( $post_type_object->cap->create_posts ) ) {
return '';
}
// Special case for the privacy policy page which is associated to a specific capability
if ( 'page' === $post_type_object->name && ! current_user_can( 'manage_privacy_options' ) ) {
$privacy_page = get_option( 'wp_page_for_privacy_policy' );
if ( $privacy_page && in_array( $post_id, $this->model->post->get_translations( $privacy_page ) ) ) {
return '';
}
}
if ( 'attachment' == $post_type ) {
$args = array(
'action' => 'translate_media',
'from_media' => $post_id,
'new_lang' => $language->slug,
);
// Add nonce for media as we will directly publish a new attachment from a click on this link
$link = wp_nonce_url( add_query_arg( $args, admin_url( 'admin.php' ) ), 'translate_media' );
} else {
$args = array(
'post_type' => $post_type,
'from_post' => $post_id,
'new_lang' => $language->slug,
);
$link = add_query_arg( $args, admin_url( 'post-new.php' ) );
}
/**
* Filter the new post translation link
*
* @since 1.8
*
* @param string $link the new post translation link
* @param object $language the language of the new translation
* @param int $post_id the source post id
*/
return apply_filters( 'pll_get_new_post_translation_link', $link, $language, $post_id );
}
/**
* Returns html markup for a new post translation link
*
* @since 1.8
*
* @param int $post_id
* @param object $language
* @return string
*/
public function new_post_translation_link( $post_id, $language ) {
$link = $this->get_new_post_translation_link( $post_id, $language );
return $link ? sprintf(
'<a href="%1$s" class="pll_icon_add"><span class="screen-reader-text">%2$s</span></a>',
esc_url( $link ),
/* translators: accessibility text, %s is a native language name */
esc_html( sprintf( __( 'Add a translation in %s', 'polylang' ), $language->name ) )
) : '';
}
/**
* Returns html markup for a translation link
*
* @since 1.4
*
* @param int $post_id translation post id
* @return string
*/
public function edit_post_translation_link( $post_id ) {
$link = get_edit_post_link( $post_id );
$language = $this->model->post->get_language( $post_id );
return $link ? sprintf(
'<a href="%1$s" class="pll_icon_edit"><span class="screen-reader-text">%2$s</span></a>',
esc_url( $link ),
/* translators: accessibility text, %s is a native language name */
esc_html( sprintf( __( 'Edit the translation in %s', 'polylang' ), $language->name ) )
) : '';
}
/**
* Get the link to create a new term translation
*
* @since 1.5
*
* @param int $term_id
* @param string $taxonomy
* @param string $post_type
* @param object $language
* @return string
*/
public function get_new_term_translation_link( $term_id, $taxonomy, $post_type, $language ) {
$tax = get_taxonomy( $taxonomy );
if ( ! $tax || ! current_user_can( $tax->cap->edit_terms ) ) {
return '';
}
$args = array(
'taxonomy' => $taxonomy,
'post_type' => $post_type,
'from_tag' => $term_id,
'new_lang' => $language->slug,
);
$link = add_query_arg( $args, admin_url( 'edit-tags.php' ) );
/**
* Filter the new term translation link
*
* @since 1.8
*
* @param string $link the new term translation link
* @param object $language the language of the new translation
* @param int $term_id the source term id
* @param string $taxonomy
* @param string $post_type
*/
return apply_filters( 'pll_get_new_term_translation_link', $link, $language, $term_id, $taxonomy, $post_type );
}
/**
* Returns html markup for a new term translation
*
* @since 1.8
*
* @param int $term_id
* @param string $taxonomy
* @param string $post_type
* @param object $language
* @return string
*/
public function new_term_translation_link( $term_id, $taxonomy, $post_type, $language ) {
$link = $this->get_new_term_translation_link( $term_id, $taxonomy, $post_type, $language );
return $link ? sprintf(
'<a href="%1$s" class="pll_icon_add"><span class="screen-reader-text">%2$s</span></a>',
esc_url( $link ),
/* translators: accessibility text, %s is a native language name */
esc_html( sprintf( __( 'Add a translation in %s', 'polylang' ), $language->name ) )
) : '';
}
/**
* Returns html markup for a term translation link
*
* @since 1.4
*
* @param object $term_id translation term id
* @param string $taxonomy
* @param string $post_type
* @return string
*/
public function edit_term_translation_link( $term_id, $taxonomy, $post_type ) {
$link = get_edit_term_link( $term_id, $taxonomy, $post_type );
$language = $this->model->term->get_language( $term_id );
return $link ? sprintf(
'<a href="%1$s" class="pll_icon_edit"><span class="screen-reader-text">%2$s</span></a>',
esc_url( $link ),
/* translators: accessibility text, %s is a native language name */
esc_html( sprintf( __( 'Edit the translation in %s', 'polylang' ), $language->name ) )
) : '';
}
}