Version en ingles y español

This commit is contained in:
Gabriel
2026-10-12 09:09:57 -06:00
parent 0592d5d0ac
commit 95d5a49f62
885 changed files with 112343 additions and 404 deletions
+696 -291
View File
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
.dt-duplicate-post-status-info .components-button.is-tertiary.is-link {
color: #ffffff;
background-color: #007cba;
border: 1px solid #007cba;
text-decoration: none;
border-radius: 3px;
padding: 5px 10px 8px;
font-weight: bold;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
}
.dt-duplicate-post-status-info .components-button.is-tertiary.is-link:hover{
border-color: #0071a1;
background-color: #0071a1;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
}
@@ -0,0 +1,90 @@
.dpmrs {
width: 100%;
background: #f5f5f5;
border: 1px solid #cdcdcd;
border-left: 4px solid #0073aa;
display: none;
overflow: auto;
}
.dpmrs .l_dpmrs {
width: 200px;
float: left;
}
.dpmrs .l_dpmrs img {
float: left;
padding: 10px;
}
.dpmrs .r_dpmrs {
float: left;
padding: 15px 10px;
}
.close_dp_help {
text-decoration: none;
border-radius: 4px;
padding: 5px 15px;
color: #fff;
font-size: 16px;
margin: 10px;
}
.close_dp_help:hover {
color: #fff !important;
}
.close_dp_help.fm_close_btn {
float: right;
cursor: pointer;
text-decoration: none;
background: #e00e0e;
border-radius: 100%;
padding: 0px 6px;
display: block;
color: #fff;
font-size: 10px;
margin: 0px;
}
.close_dp_help.fm_close_btn_1 {
background: #fbc21c;
border-bottom: 3px solid #b18400;
margin-right: 0px;
margin-left: 0px;
}
.close_dp_help.fm_close_btn_2 {
background: #239200;
border-bottom: 3px solid #155600;
margin-right: 0px;
}
.close_dp_help.fm_close_btn_3 {
background: #ff1105;
border-bottom: 3px solid #b30900;
}
.clear {
clear: both;
}
.duplicate_page_settings .saving-txt {
background: #fff;
padding: 10px 15px;
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
margin-top: 20px;
border-radius: 3px;
border:1px solid #c3c4c7;
border-left: solid 4px #2271b1;
}
.duplicate_page_settings .settings-error{
margin-bottom: 0;
}
.duplicate_page_settings #poststuff{
padding-top: 0px;
}
.duplicate_page_settings .settings-error.notice{
margin-top: 20px;
margin-bottom: 0px;
}
@@ -0,0 +1,439 @@
<?php
/*
Plugin Name: Duplicate Page
Plugin URI: https://duplicatepro.com/
Description: Duplicate Posts, Pages and Custom Posts using single click.
Author: mndpsingh287
Version: 4.5.9
Author URI: https://profiles.wordpress.org/mndpsingh287/
License: GPLv2
Text Domain: duplicate-page
*/
if (!defined('DUPLICATE_PAGE_PLUGIN_DIRNAME')) {
define('DUPLICATE_PAGE_PLUGIN_DIRNAME', plugin_basename(dirname(__FILE__)));
}
if (!defined('DUPLICATE_PAGE_PLUGIN_VERSION')) {
define('DUPLICATE_PAGE_PLUGIN_VERSION', '4.5.9');
}
if (!class_exists('duplicate_page')):
class duplicate_page
{
/*
* AutoLoad Hooks
*/
public function __construct()
{
$opt = get_option('duplicate_page_options');
register_activation_hook(__FILE__, array(&$this, 'duplicate_page_install'));
add_action('admin_menu', array(&$this, 'duplicate_page_options_page'));
add_filter('plugin_action_links', array(&$this, 'duplicate_page_plugin_action_links'), 10, 2);
add_action('admin_action_dt_duplicate_post_as_draft', array(&$this, 'dt_duplicate_post_as_draft'));
add_filter('post_row_actions', array(&$this, 'dt_duplicate_post_link'), 10, 2);
add_filter('page_row_actions', array(&$this, 'dt_duplicate_post_link'), 10, 2);
if (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'gutenberg') {
add_action('admin_head', array(&$this, 'duplicate_page_custom_button_guten'));
} elseif(isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'all'){
add_action('admin_head', array(&$this, 'duplicate_page_custom_button_guten'));
add_action('post_submitbox_misc_actions', array(&$this, 'duplicate_page_custom_button_classic'));
} else {
add_action('post_submitbox_misc_actions', array(&$this, 'duplicate_page_custom_button_classic'));
}
add_action('wp_before_admin_bar_render', array(&$this, 'duplicate_page_admin_bar_link'));
add_action('init', array(&$this, 'duplicate_page_load_text_domain'));
add_action('wp_ajax_mk_dp_close_dp_help', array($this, 'mk_dp_close_dp_help'));
}
/*
* Localization - 19-dec-2016
*/
public function duplicate_page_load_text_domain()
{
load_plugin_textdomain('duplicate-page', false, DUPLICATE_PAGE_PLUGIN_DIRNAME.'/languages');
}
/*
* Activation Hook
*/
public function duplicate_page_install()
{
$defaultsettings = array(
'duplicate_post_status' => 'draft',
'duplicate_post_redirect' => 'to_list',
'duplicate_post_suffix' => '',
'duplicate_post_editor' => 'classic',
);
$opt = get_option('duplicate_page_options');
if (!isset($opt['duplicate_post_status'])) {
update_option('duplicate_page_options', $defaultsettings);
}
}
/*
Action Links
*/
public function duplicate_page_plugin_action_links($links, $file)
{
if ($file == plugin_basename(__FILE__)) {
$duplicate_page_links = '<a href="'.esc_url(get_admin_url()).'options-general.php?page=duplicate_page_settings">'.__('Settings', 'duplicate-page').'</a>';
$duplicate_page_donate = '<a href="https://www.webdesi9.com/donate/?plugin=duplicate-page" title="'.__('Donate Now','duplicate-page').'" target="_blank" style="font-weight:bold">'.__('Donate', 'duplicate-page').'</a>';
array_unshift($links, $duplicate_page_donate);
array_unshift($links, $duplicate_page_links);
}
return $links;
}
/*
* Admin Menu
*/
public function duplicate_page_options_page()
{
add_options_page(__('Duplicate Page', 'duplicate-page'), __('Duplicate Page', 'duplicate-page'), 'manage_options', 'duplicate_page_settings', array(&$this, 'duplicate_page_settings'));
}
/*
* Duplicate Page Admin Settings
*/
public function duplicate_page_settings()
{
if (current_user_can('manage_options')) {
include 'inc/admin-settings.php';
}
}
/*
* Main function
*/
public function dt_duplicate_post_as_draft()
{
/*
* get Nonce value
*/
$nonce = sanitize_text_field($_REQUEST['nonce']);
/*
* get the original post id
*/
$post_id = (isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post']));
if(!wp_verify_nonce( $nonce, 'dt-duplicate-page-'.$post_id)) {
wp_die(__('Security check issue, Please try again.','duplicate-page'));
}
$post = get_post($post_id);
$current_user_id = get_current_user_id();
if (current_user_can('manage_options') || current_user_can('edit_others_posts')) {
$this->duplicate_edit_post($post_id);
}
else if (current_user_can('edit_posts') && !current_user_can('publish_posts') && $current_user_id == $post->post_author){
$this->duplicate_edit_post($post_id, 'pending');
}
else if (current_user_can('edit_post', $post_id) && $current_user_id == $post->post_author ){
$this->duplicate_edit_post($post_id);
}
else {
wp_die(__('Unauthorized Access.','duplicate-page'));
}
}
/**
* Duplicate edit post
*/
public function duplicate_edit_post($post_id,$post_status_update='')
{
global $wpdb;
$opt = get_option('duplicate_page_options');
$suffix = isset($opt['duplicate_post_suffix']) && !empty($opt['duplicate_post_suffix']) ? ' -- '.esc_attr($opt['duplicate_post_suffix']) : '';
if($post_status_update == ''){
$post_status = !empty($opt['duplicate_post_status']) ? esc_attr($opt['duplicate_post_status']) : 'draft';
}else{
$post_status = $post_status_update;
}
$redirectit = !empty($opt['duplicate_post_redirect']) ? esc_attr($opt['duplicate_post_redirect']) : 'to_list';
if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'dt_duplicate_post_as_draft' == sanitize_text_field($_REQUEST['action'])))) {
wp_die(__('No post to duplicate has been supplied!','duplicate-page'));
}
$returnpage = '';
/*
* and all the original post data then
*/
$post = get_post($post_id);
/*
* if you don't want current user to be the new post author,
* then change next couple of lines to this: $new_post_author = $post->post_author;
*/
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/*
* if post data exists, create the post duplicate
*/
if (isset($post) && $post != null) {
/*
* new post data array
*/
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'gutenberg') ? wp_slash($post->post_content) : $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => $post_status,
'post_title' => $post->post_title.$suffix,
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order,
);
/*
* insert the post by wp_insert_post() function
*/
$new_post_id = wp_insert_post($args);
if(is_wp_error($new_post_id)){
wp_die(__($new_post_id->get_error_message(),'duplicate-page'));
}
/*
* get all current post terms ad set them to the new post draft
*/
$taxonomies = array_map('sanitize_text_field',get_object_taxonomies($post->post_type));
if (!empty($taxonomies) && is_array($taxonomies)):
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
}
endif;
/*
* duplicate all post meta
*/
$post_meta_keys = get_post_custom_keys( $post_id );
if ( ! empty( $post_meta_keys ) ) {
foreach ( $post_meta_keys as $meta_key ) {
// get_post_meta returns already-unserialized values safely
$meta_values = get_post_meta( $post_id, $meta_key );
foreach ( $meta_values as $meta_value ) {
// Block object injection - reject serialized objects (O: and C: patterns)
// unless the meta key belongs to a known plugin that legitimately stores them.
if ( is_string( $meta_value ) && preg_match( '/^O:\d+:|C:\d+:/', $meta_value ) ) {
$safe_prefixes = apply_filters( 'duplicate_page_safe_meta_prefixes', array(
'breakdance_',
'_breakdance_',
) );
$is_safe = false;
foreach ( $safe_prefixes as $prefix ) {
if ( strpos( $meta_key, $prefix ) === 0 ) {
$is_safe = true;
break;
}
}
if ( ! $is_safe ) {
continue;
}
}
update_post_meta( $new_post_id, $meta_key, wp_slash( $meta_value ) );
}
}
}
/**
* Elementor compatibility fixes
*/
if(is_plugin_active( 'elementor/elementor.php' ) && class_exists('\Elementor\Core\Files\CSS\Post')){
$css = \Elementor\Core\Files\CSS\Post::create( $new_post_id );
$css->update();
}
/**
* Breakdance compatibility
*/
if ( defined( 'BREAKDANCE_PLUGIN_FILE' ) || function_exists( 'Breakdance\isBreakdanceRequest' ) ) {
$breakdance_timestamp_keys = apply_filters( 'duplicate_page_breakdance_timestamp_keys', array(
'breakdance_created_at',
'_breakdance_created_at',
) );
foreach ( $breakdance_timestamp_keys as $ts_key ) {
if ( get_post_meta( $new_post_id, $ts_key, true ) ) {
update_post_meta( $new_post_id, $ts_key, current_time( 'mysql' ) );
}
}
}
/**
* The Events Calendar compatibility
*/
if ( function_exists( 'tribe_get_event' ) ) {
wp_update_post( array( 'ID' => $new_post_id ) );
}
/*
* finally, redirecting to your choice
*/
if ($post->post_type != 'post'){
$returnpage = '?post_type='.$post->post_type;
}
if (!empty($redirectit) && $redirectit == 'to_list'){
wp_redirect(esc_url_raw(admin_url('edit.php'.$returnpage)));
} elseif (!empty($redirectit) && $redirectit == 'to_page'){
wp_redirect(esc_url_raw(admin_url('post.php?action=edit&post='.$new_post_id)));
} else {
wp_redirect(esc_url_raw(admin_url('edit.php'.$returnpage)));
}
exit;
}
else {
wp_die(__('Error! Post creation failed, could not find original post: ','duplicate-page').$post_id);
}
exit;
}
/*
* Add the duplicate link to action list for post_row_actions
*/
public function dt_duplicate_post_link($actions, $post)
{
// Skip acf-field-group post type
if($post->post_type == 'acf-field-group'){
return $actions;
}
$opt = get_option('duplicate_page_options');
$post_status = !empty($opt['duplicate_post_status']) ? esc_attr($opt['duplicate_post_status']) : 'draft';
if (current_user_can('edit_post', $post->ID)) {
$actions['duplicate'] = isset($post) ? '<a href="admin.php?action=dt_duplicate_post_as_draft&amp;post='.intval($post->ID).'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.intval($post->ID) ).'" title="'.__('Duplicate this as ', 'duplicate-page').$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>' : '';
}
return $actions;
}
/*
* Add the duplicate link to edit screen - classic editor
*/
public function duplicate_page_custom_button_classic()
{
global $post;
$opt = get_option('duplicate_page_options');
$post_status = !empty($opt['duplicate_post_status']) ? esc_attr($opt['duplicate_post_status']) : 'draft';
$html = '<div id="major-publishing-actions">';
$html .= '<div id="export-action">';
$html .= isset($post) ? '<a href="admin.php?action=dt_duplicate_post_as_draft&amp;post='.intval($post->ID).'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="'.__('Duplicate this as ','duplicate-page').$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>' :'';
$html .= '</div>';
$html .= '</div>';
$content = wpautop($html);
$content = str_replace(']]>', ']]>', $content);
echo $content;
}
/*
* Add the duplicate link to edit screen - gutenberg
*/
public function duplicate_page_custom_button_guten()
{
global $post;
$screen = get_current_screen();
if ( ! $screen || $screen->base !== 'post' ) {
return;
}
if ($post) {
$opt = get_option('duplicate_page_options');
$post_status = !empty($opt['duplicate_post_status']) ? esc_attr($opt['duplicate_post_status']) : 'draft';
if (isset($opt['duplicate_post_editor']) && ($opt['duplicate_post_editor'] == 'gutenberg' || $opt['duplicate_post_editor'] == 'all')) {
wp_enqueue_style('dp-main-style', plugin_dir_url(__FILE__) . 'css/dp_gutenberg.css');
wp_register_script( "dt_duplicate_post_script", plugins_url( '/js/editor-script.js', __FILE__ ), array( 'wp-edit-post', 'wp-plugins', 'wp-i18n', 'wp-element' ), DUPLICATE_PAGE_PLUGIN_VERSION);
wp_localize_script( 'dt_duplicate_post_script', 'dt_params', array(
'dp_post_id' => intval($post->ID),
'dtnonce' => wp_create_nonce( 'dt-duplicate-page-'.intval($post->ID)),
'dp_post_text' => __("Duplicate This",'duplicate-page'),
'dp_post_title'=> __('Duplicate this as ','duplicate-page').$post_status,
'dp_duplicate_link' => "admin.php?action=dt_duplicate_post_as_draft"
)
);
wp_enqueue_script( 'dt_duplicate_post_script' );
}
}
}
/*
* Admin Bar Duplicate This Link
*/
public function duplicate_page_admin_bar_link()
{
global $wp_admin_bar, $post;
$opt = get_option('duplicate_page_options');
$post_status = !empty($opt['duplicate_post_status']) ? esc_attr($opt['duplicate_post_status']) : 'draft';
$current_object = get_queried_object();
if (empty($current_object)) {
return;
}
if (!empty($current_object->post_type)
&& ($post_type_object = get_post_type_object($current_object->post_type))
&& ($post_type_object->show_ui || $current_object->post_type == 'attachment')) {
$wp_admin_bar->add_menu(array(
'parent' => 'edit',
'id' => 'duplicate_this',
'title' => __('Duplicate This as ', 'duplicate-page').$post_status,
'href' => isset($post) ? esc_url_raw(admin_url().'admin.php?action=dt_duplicate_post_as_draft&amp;post='.intval($post->ID).'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.intval($post->ID))) :'',
));
}
}
/*
* Redirect function
*/
public static function dp_redirect($url)
{
$web_url = esc_url_raw($url);
wp_register_script( 'dp-setting-redirect', '');
wp_enqueue_script( 'dp-setting-redirect' );
wp_add_inline_script(
'dp-setting-redirect',
' window.location.href="'.$web_url.'" ;'
);
}
/*
Load Help Desk
*/
public function load_help_desk() {
$mkcontent = '';
$mkcontent .= '<div class="dpmrs" style="display:none;">';
$mkcontent .= '<div class="l_dpmrs">';
$mkcontent .= '';
$mkcontent .= '</div>';
$mkcontent .= '<div class="r_dpmrs">';
$mkcontent .= '<a class="close_dp_help fm_close_btn" href="javascript:void(0)" data-ct="rate_later" title="'.__('close','duplicate-page').'">X</a><strong>'.__('Duplicate Page','duplicate-page').'</strong><p>'.__('We love and care about you. Our team is putting maximum efforts to provide you the best functionalities. It would be highly appreciable if you could spend a couple of seconds to give a Nice Review to the plugin to appreciate our efforts. So we can work hard to provide new features regularly :)','duplicate-page').'</p><a class="close_dp_help fm_close_btn_1" href="javascript:void(0)" data-ct="rate_later" title="'.__('Remind me later','duplicate-page').'">'.__('Later','duplicate-page').'</a> <a class="close_dp_help fm_close_btn_2" href="https://wordpress.org/support/plugin/duplicate-page/reviews/?filter=5" data-ct="rate_now" title="'.__('Rate us now','duplicate-page').'" target="_blank">'.__('Rate Us','duplicate-page').'</a> <a class="close_dp_help fm_close_btn_3" href="javascript:void(0)" data-ct="rate_never" title="'.__('Not interested','duplicate-page').'">'.__('Never','duplicate-page').'</a>';
$mkcontent .= '</div></div>';
if (false === ($mk_dp_close_dp_help_c = get_option('mk_fm_close_fm_help_c'))) {
echo apply_filters('the_content', $mkcontent);
}
}
/*
Close Help
*/
public function mk_dp_close_dp_help() {
$nonce = sanitize_text_field($_REQUEST['nonce']);
if (wp_verify_nonce($nonce, 'nc_help_desk')) {
if (false === ($mk_fm_close_fm_help_c = get_option('mk_fm_close_fm_help_c'))) {
$set = update_option('mk_fm_close_fm_help_c', 'done');
if ($set) {
echo 'ok';
} else {
echo 'oh';
}
} else {
echo 'ac';
}
}else {
echo 'ac';
}
die;
}
/*
Custom Assets
*/
public function custom_assets() {
wp_enqueue_style( 'duplicate-page', plugins_url( '/css/duplicate_page.css', __FILE__ ) );
wp_enqueue_script( 'duplicate-page', plugins_url( '/js/duplicate_page.js', __FILE__ ) );
wp_localize_script( 'duplicate-page', 'dt_params', array(
'ajax_url' => admin_url( 'admin-ajax.php'),
'nonce' => wp_create_nonce( 'nc_help_desk' ))
);
}
}
new duplicate_page();
endif;
@@ -0,0 +1,90 @@
<?php if (!defined('ABSPATH') && !current_user_can('manage_options')) {
exit;
}
$this->custom_assets();
?>
<div class="wrap duplicate_page_settings">
<?php
$this->load_help_desk(); ?>
<h1><?php _e('Duplicate Page Settings ', 'duplicate-page'); ?><a href="https://duplicatepro.com/pro/" target="_blank" class="button button-primary"><?php _e('Buy PRO', 'duplicate-page'); ?></a></h1>
<?php
$msg = isset($_GET['msg']) ? intval($_GET['msg']) : '';
if (current_user_can('manage_options') && isset($_POST['submit_duplicate_page']) && wp_verify_nonce(sanitize_text_field($_POST['duplicatepage_nonce_field']), 'duplicatepage_action')):
_e('<div class="saving-txt"><strong>Saving Please wait...</strong></div>','duplicate-page');
$duplicatepageoptions = array(
"duplicate_post_editor" => sanitize_text_field(htmlentities($_POST["duplicate_post_editor"])),
"duplicate_post_status" => sanitize_text_field(htmlentities($_POST["duplicate_post_status"])),
"duplicate_post_redirect" => sanitize_text_field(htmlentities($_POST["duplicate_post_redirect"])),
"duplicate_post_suffix" => sanitize_text_field(htmlentities($_POST["duplicate_post_suffix"]))
);
$saveSettings = update_option('duplicate_page_options', $duplicatepageoptions);
if ($saveSettings) {
duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=1');
} else {
duplicate_page::dp_redirect('options-general.php?page=duplicate_page_settings&msg=2');
}
endif;
$opt = get_option('duplicate_page_options');
if (!empty($msg) && $msg == 1):
_e('<div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
<p><strong>Settings saved.</strong></p><button class="notice-dismiss button-custom-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice</span></button></div>','duplicate-page');
elseif (!empty($msg) && $msg == 2):
_e('<div class="error settings-error notice is-dismissible" id="setting-error-settings_updated">
<p><strong>Settings not saved.</strong></p><button class="notice-dismiss button-custom-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice</span></button></div>','duplicate-page');
endif;
?>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content" style="position: relative;">
<form action="" method="post" name="duplicate_page_form">
<?php wp_nonce_field('duplicatepage_action', 'duplicatepage_nonce_field'); ?>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="duplicate_post_editor"><?php _e('Choose Editor', 'duplicate-page'); ?></label></th>
<td>
<select id="duplicate_post_editor" name="duplicate_post_editor">
<option value="all" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'all') ? "selected = 'selected'" : ''; ?>><?php _e('All Editors', 'duplicate-page'); ?></option>
<option value="classic" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'classic') ? "selected = 'selected'" : ''; ?>><?php _e('Classic Editor', 'duplicate-page'); ?></option>
<option value="gutenberg" <?php echo (isset($opt['duplicate_post_editor']) && $opt['duplicate_post_editor'] == 'gutenberg') ? "selected = 'selected'" : ''; ?>><?php _e('Gutenberg Editor', 'duplicate-page'); ?></option>
</select>
<p><?php _e('Please select which editor you are using.<strong> Default: </strong> Classic Editor', 'duplicate-page'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><label for="duplicate_post_status"><?php _e('Duplicate Post Status', 'duplicate-page'); ?></label></th>
<td>
<select id="duplicate_post_status" name="duplicate_post_status">
<option value="draft" <?php echo($opt['duplicate_post_status'] == 'draft') ? "selected = 'selected'" : ''; ?>><?php _e('Draft', 'duplicate-page'); ?></option>
<option value="publish" <?php echo($opt['duplicate_post_status'] == 'publish') ? "selected = 'selected'" : ''; ?>><?php _e('Publish', 'duplicate-page'); ?></option>
<option value="private" <?php echo($opt['duplicate_post_status'] == 'private') ? "selected = 'selected'" : ''; ?>><?php _e('Private', 'duplicate-page'); ?></option>
<option value="pending" <?php echo($opt['duplicate_post_status'] == 'pending') ? "selected = 'selected'" : ''; ?>><?php _e('Pending', 'duplicate-page'); ?></option>
</select>
<p><?php _e('Please select any post status you want to assign for duplicate post.<strong> Default: </strong> Draft','duplicate-page'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><label for="duplicate_post_redirect"><?php _e('Redirect to after click on <strong>Duplicate This Link</strong>', 'duplicate-page'); ?></label></th>
<td><select id="duplicate_post_redirect" name="duplicate_post_redirect">
<option value="to_list" <?php echo($opt['duplicate_post_redirect'] == 'to_list') ? "selected = 'selected'" : ''; ?>><?php _e('To All Posts List', 'duplicate-page'); ?></option>
<option value="to_page" <?php echo($opt['duplicate_post_redirect'] == 'to_page') ? "selected = 'selected'" : ''; ?>><?php _e('To Duplicate Edit Screen', 'duplicate-page'); ?></option>
</select>
<p><?php _e('Please select any post redirection, redirect you to selected after click on duplicate this link.<strong> Default: </strong>To All Posts List','duplicate-page'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><label for="duplicate_post_suffix"><?php _e('Duplicate Post Suffix', 'duplicate-page'); ?></label></th>
<td>
<input type="text" class="regular-text" value="<?php echo !empty($opt['duplicate_post_suffix']) ? esc_attr($opt['duplicate_post_suffix']) : ''; ?>" id="duplicate_post_suffix" name="duplicate_post_suffix">
<p><?php _e('Add a suffix for duplicate or clone post as Copy, Clone etc. It will show after title.', 'duplicate-page'); ?></p>
</td>
</tr>
</tbody></table>
<p class="submit"><input type="submit" value="<?php _e('Save Changes','duplicate-page'); ?>" class="button button-primary" id="submit" name="submit_duplicate_page"></p>
</form>
</div>
</div>
</div>
</div>
@@ -0,0 +1,28 @@
jQuery(window).on('load',function() {
jQuery('.dpmrs').delay(10000).slideDown('slow');
});
jQuery(document).ready(function () {
jQuery('.close_dp_help').on('click', function (e) {
var what_to_do = jQuery(this).data('ct');
var nonce = dt_params.nonce
jQuery.ajax({
type: "post",
url: dt_params.ajax_url,
data: {
action: "mk_dp_close_dp_help",
what_to_do: what_to_do,
nonce:nonce
},
success: function (response) {
jQuery('.dpmrs').slideUp('slow');
}
});
});
});
jQuery(document).ready(function() {
var admin_page_url = "options-general.php?page=duplicate_page_settings";
window.history.replaceState({}, document.title, admin_page_url);
});
jQuery(document).on('click', '.button-custom-dismiss', function(e) {
jQuery(this).parent().hide();
})
@@ -0,0 +1,28 @@
var el = wp.element.createElement;
var __ = wp.i18n.__;
var registerPlugin = wp.plugins.registerPlugin;
var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
var buttonControl = wp.components.Button;
function dpGutenButton({}) {
return el(
PluginPostStatusInfo,
{
className: 'dt-duplicate-post-status-info'
},
el(
buttonControl,
{
isTertiary: true,
name: 'duplicate_page_link_guten',
isLink: true,
title: dt_params.dp_post_title,
href : dt_params.dp_duplicate_link+"&post="+dt_params.dp_post_id+"&nonce="+dt_params.dtnonce
}, dt_params.dp_post_text
)
);
}
registerPlugin( 'dt-duplicate-post-status-info-plugin', {
render: dpGutenButton
} );
@@ -0,0 +1,142 @@
msgid ""
msgstr ""
"Project-Id-Version: Duplicate Page v Češtině (v2)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-12 19:23+0100\n"
"PO-Revision-Date: 2018-02-05 16:32+0530\n"
"Language-Team: LeBaux <lebaux@gmail.com>\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.4\n"
"Last-Translator: Pierre LeBaux (EN>SK>CS) <lebaux@gmail.com>\n"
"Language: cs_CZ\n"
#: admin-settings.php:3
msgid "Duplicate Page Settings"
msgstr "Nastavení duplikátoru obsahu"
#: admin-settings.php:8
msgid "<strong>Saving Please wait...</strong>"
msgstr "<strong>Ukládám nastavení...</strong>"
#: admin-settings.php:27
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" type="
"\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></"
"button></div>"
msgstr ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Nastavení uloženo.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Rozumím.</span></button></"
"div>"
#: admin-settings.php:30
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</"
"span></button></div>"
msgstr ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Nastavení nebylo uloženo!</strong></p><button class=\"notice-"
"dismiss\" type=\"button\"><span class=\"screen-reader-text\">Rozumím.</"
"span></button></div>"
#: admin-settings.php:43
msgid "Duplicate Post Status"
msgstr "Stav duplikátu po vytvoření"
#: admin-settings.php:50
msgid ""
"Please select any post status you want to assign for duplicate post. "
"<strong>Default:</strong> Draft."
msgstr ""
"Když se vytvoří duplikát, je potřeba mu nastavit stav publikovaní. "
"<strong>Výchozí:</strong> Koncept"
#: admin-settings.php:54
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr "Kam přesměrovat potom, co se vytvoří <strong>duplikát</strong>"
#: admin-settings.php:56
msgid "To All Posts List"
msgstr "Zůstat kde jste byli"
#: admin-settings.php:57
msgid "To Duplicate Edit Screen"
msgstr "Otevřít duplikát pro editaci"
#: admin-settings.php:59
msgid ""
"Please select any post redirection, redirect you to selected after click on "
"duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
"Co se stane poté, co kliknete na tlačítko duplikovat. <strong>Výchozí:</"
"strong> Zůstat kde jste byli"
#: admin-settings.php:63
msgid "Duplicate Post Suffix"
msgstr "Přípona duplikovaného obsahu"
#: admin-settings.php:66
msgid ""
"Add a suffix for duplicate or clone post as Copy, Clone etc. It will show "
"after title."
msgstr ""
"Zde si můžete zvolit příponu, kterou plugin připojí k názvu duplikované "
"položky. Může zůstat prázdné, nebo například: kopie."
#: admin-settings.php:76
msgid ""
"Contribute some donation, to make plugin more stable. You can pay amount of "
"your choice."
msgstr ""
"Pokud je pro vás tento plugin užitečný, můžete vývojářovi třeba přispět na "
"jedno orosené."
#. Name of the plugin
msgid "Duplicate Page"
msgstr "Duplikátor obsahu"
#. Description of the plugin
msgid "Duplicate Posts, Pages and Custom Posts using single click."
msgstr "Duplikujte Příspěvky, Stránky a Custom Posty jedním kliknutím."
#. URI of the plugin
msgid "https://wordpress.org/plugins/duplicate-page/"
msgstr "https://wordpress.org/plugins/duplicate-page/"
#. Author of the plugin
msgid "mndpsingh287"
msgstr "mndpsingh287"
#. Author URI of the plugin
msgid "https://profiles.wordpress.org/mndpsingh287/"
msgstr "https://profiles.wordpress.org/mndpsingh287/"
#. Post Links
msgid "Duplicate This"
msgstr "Duplikovat"
#. Post Link title (status as draft)
msgid "Duplicate this as draft"
msgstr "Duplikujte to jako koncept"
#. Post Link title (status as publish)
msgid "Duplicate this as publish"
msgstr "Duplikujte to jako publikovat"
#. Post Link title (status as private)
msgid "Duplicate this as private"
msgstr "Duplikujte to jako soukromé"
#. Post Link title (status as pending)
msgid "Duplicate this as pending"
msgstr "Duplikujte to jako čekající"
@@ -0,0 +1,182 @@
msgid ""
msgstr ""
"Project-Id-Version: Duplicate Page\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-16 11:31+0100\n"
"PO-Revision-Date: 2018-11-16 11:32+0100\n"
"Last-Translator: Thorsten Wollenhöfer <thorsten.wollenhoefer@gmail.com>\n"
"Language-Team: Hindi\n"
"Language: de_DE@formal\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2\n"
#: admin-settings.php:3
msgid "Duplicate Page Settings "
msgstr "Duplicate Page Einstellungen "
#: admin-settings.php:3
msgid "Buy PRO"
msgstr "PRO-Version kaufen"
#: admin-settings.php:8
msgid "<strong>Saving Please wait...</strong>"
msgstr "<strong>Speichern... Bitte warten.</strong>"
#: admin-settings.php:27
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" type="
"\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></"
"button></div>"
msgstr ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Einstellungen gespeichert.</strong></p><button class=\"notice-"
"dismiss\" type=\"button\"><span class=\"screen-reader-text\">Meldung "
"ausblenden.</span></button></div>"
#: admin-settings.php:30
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</"
"span></button></div>"
msgstr ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Einstellungen nicht gespeichert.</strong></p><button class="
"\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text"
"\">Meldung ausblenden.</span></button></div>"
#: admin-settings.php:42
msgid "Duplicate Post Status"
msgstr "Duplicate Post Status"
#: admin-settings.php:45
msgid "Draft"
msgstr "Entwurf"
#: admin-settings.php:46
msgid "Publish"
msgstr "Veröffentlichen"
#: admin-settings.php:47
msgid "Private"
msgstr "Privat"
#: admin-settings.php:48
msgid "Pending"
msgstr "Ausstehend"
#: admin-settings.php:50
msgid ""
"Please select any post status you want to assign for duplicate post. "
"<strong>Default:</strong> Draft."
msgstr ""
"Bitte wählen Sie einen beliebigen Beitragsstatus, den Sie dem duplizierten "
"Beitrag zuweisen wollen. <strong>Standard:</strong> Entwurf."
#: admin-settings.php:54
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr "Weiterleiten nach Klick auf <strong>Diesen Link duplizieren</strong>"
#: admin-settings.php:56
msgid "To All Posts List"
msgstr "Zur Liste mit allen Beiträgen"
#: admin-settings.php:57
msgid "To Duplicate Edit Screen"
msgstr "Zum Duplizieren-Bildschirm-bearbeiten"
#: admin-settings.php:59
msgid ""
"Please select any post redirection, redirect you to selected after click on "
"duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
"Bitte wählen Sie eine beliebige Beitragsweiterleitung aus. Sie werden "
"weitergeleitet, sobald sie auf die Auswahl für das Duplizieren des Links "
"klicken. <strong>Standard:</strong> Zur aktuellen Liste."
#: admin-settings.php:63
msgid "Duplicate Post Suffix"
msgstr "Beitragssuffix duplizieren"
#: admin-settings.php:66
msgid ""
"Add a suffix for duplicate or clone post as Copy, Clone etc. It will show "
"after title."
msgstr ""
"Füge einen Suffix für das Duplizieren oder Klonen eines Beitrags als Kopie, "
"Klon etc hinzu. Dieser wird nach dem Titel angezeigt."
#: admin-settings.php:76
msgid ""
"Contribute some donation, to make plugin more stable. You can pay amount of "
"your choice."
msgstr ""
"Spenden Sie etwas, um das Plugin stabiler zu machen. Sie können den Betrag "
"Ihrer Wahl bestimmen."
#: duplicatepage.php:55
msgid "Settings"
msgstr "Einstellungen"
#: duplicatepage.php:56
msgid "Donate"
msgstr "Spenden"
#. Plugin Name of the plugin/theme
#: duplicatepage.php:67
msgid "Duplicate Page"
msgstr "Seite duplizieren"
#: duplicatepage.php:179 duplicatepage.php:192
msgid "Duplicate This"
msgstr "Seite duplizieren"
#: duplicatepage.php:214
msgid "Duplicate This as "
msgstr "Duplizieren Sie dies als "
#. Plugin URI of the plugin/theme
msgid "https://wordpress.org/plugins/duplicate-page/"
msgstr "https://wordpress.org/plugins/duplicate-page/"
#. Description of the plugin/theme
msgid "Duplicate Posts, Pages and Custom Posts using single click."
msgstr ""
"Duplizieren Sie Beiträge, Seiten und benutzerdefinierte Beiträge mit einem "
"einzigen Klick."
#. Author of the plugin/theme
msgid "mndpsingh287"
msgstr "mndpsingh287"
#. Author URI of the plugin/theme
msgid "https://profiles.wordpress.org/mndpsingh287/"
msgstr "https://profiles.wordpress.org/mndpsingh287/"
#. Post Link
msgid "Duplicate This"
msgstr "Seite duplizieren"
#. Post Link title (status as draft)
msgid "Duplicate this as draft"
msgstr "Duplizieren Sie dies als Entwurf"
#. Post Link title (status as publish)
msgid "Duplicate this as publish"
msgstr "Duplizieren Sie dies als veröffentlichen"
#. Post Link title (status as private)
msgid "Duplicate this as private"
msgstr "Dupliziere dies als privat"
#. Post Link title (status as pending)
msgid "Duplicate this as pending"
msgstr "Duplizieren Sie dies als ausstehend"
@@ -0,0 +1,144 @@
msgid ""
msgstr ""
"Project-Id-Version: Duplicate Page\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-23 14:05+0100\n"
"PO-Revision-Date: 2018-02-23 14:16+0100\n"
"Language-Team: Hindi\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"Last-Translator: \n"
"Language: fr_FR\n"
#: admin-settings.php:3
msgid "Duplicate Page Settings"
msgstr "Réglages \"DUPLICATE PAGE\""
#: admin-settings.php:8
msgid "<strong>Saving Please wait...</strong>"
msgstr "<strong>Enregistrement, patientez...</strong>"
#: admin-settings.php:27
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" type="
"\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></"
"button></div>"
msgstr ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Paramètres enregistrés</strong></p><button class=\"notice-dismiss"
"\" type=\"button\"><span class=\"screen-reader-text\">Fermer la notice</"
"span></button></div>"
#: admin-settings.php:30
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</"
"span></button></div>"
msgstr ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Fermer la notice</span></"
"button></div>"
#: admin-settings.php:43
msgid "Duplicate Post Status"
msgstr "Statut \"DUPLICATE PAGE\""
#: admin-settings.php:50
msgid ""
"Please select any post status you want to assign for duplicate post. "
"<strong>Default:</strong> Draft."
msgstr ""
"Veuillez sélectionner un statut de publication que vous souhaitez attribuer "
"pour une page dubliqué<strong> Par défaut: </ strong> Brouillon."
#: admin-settings.php:54
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr "Rediriger après avoir cliquer sur <strong>Dupliquer ce lien</strong>"
#: admin-settings.php:56
msgid "To All Posts List"
msgstr "Sur la liste de tout les articles"
#: admin-settings.php:57
msgid "To Duplicate Edit Screen"
msgstr "Sur l’écran de duplication"
#: admin-settings.php:59
msgid ""
"Please select any post redirection, redirect you to selected after click on "
"duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
"S'il vous plaît sélectionner chaque redirection d'article, afin de "
"déterminer l’action après avoir cliqué sur dupliquer ce lien. <strong>Par "
"défaut:</strong> Sur la liste de tous les articles"
#: admin-settings.php:63
msgid "Duplicate Post Suffix"
msgstr "Dupliquer le suffixe de l'article"
#: admin-settings.php:66
msgid ""
"Add a suffix for duplicate or clone post as Copy, Clone etc. It will show "
"after title."
msgstr ""
"Ajoute un suffixe lorsque vous dupliquez ou clonez. Il sera mis après le "
"titre"
#: admin-settings.php:76
msgid ""
"Contribute some donation, to make plugin more stable. You can pay amount of "
"your choice."
msgstr ""
"Contribuer à un don, pour rendre le plugin plus stable. Vous pouvez donner "
"le montant de votre choix."
#. Name of the plugin
msgid "Duplicate Page"
msgstr "Dupliquer les Pages"
#. Description of the plugin
msgid "Duplicate Posts, Pages and Custom Posts using single click."
msgstr ""
"Dupliquer les articles, pages, et articles personnalisé juste en cliquant"
#. URI of the plugin
msgid "https://wordpress.org/plugins/duplicate-page/"
msgstr "https://wordpress.org/plugins/duplicate-page/"
#. Author of the plugin
msgid "mndpsingh287"
msgstr "mndpsingh287"
#. Author URI of the plugin
msgid "https://profiles.wordpress.org/mndpsingh287/"
msgstr "https://profiles.wordpress.org/mndpsingh287/"
#. Post Links
msgid "Duplicate This"
msgstr "Dupliquer ceci"
#. Post Link title (status as draft)
msgid "Duplicate this as draft"
msgstr "Dupliquer ceci comme brouillon"
#. Post Link title (status as publish)
msgid "Duplicate this as publish"
msgstr "Dupliquer cela comme publier"
#. Post Link title (status as private)
msgid "Duplicate this as private"
msgstr "Dupliquez cela comme privé"
#. Post Link title (status as pending)
msgid "Duplicate this as pending"
msgstr "Dupliquer cela en attente"
@@ -0,0 +1,124 @@
msgid ""
msgstr ""
"Project-Id-Version: Duplicate Page\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-19 12:43+0000\n"
"PO-Revision-Date: 2016-12-19 12:52+0000\n"
"Last-Translator: admin <munishthedeveloper48@gmail.com>\n"
"Language-Team: Hindi\n"
"Language: hi-IN\n"
"Plural-Forms: nplurals=2; plural=n != 1\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco - https://localise.biz/"
#: admin-settings.php:3
msgid "Duplicate Page Settings"
msgstr "डुप्लिकेट पृष्ठ सेटिंग"
#: admin-settings.php:8
msgid "<strong>Saving Please wait...</strong>"
msgstr "<strong>सुरक्षित कर रहा है कृपया प्रतीक्षा करें...</strong>"
#: admin-settings.php:27
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice."
"</span></button></div>"
msgstr ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>सेटिंग्स को सहेजा गया।</strong></p><button class=\"notice-"
"dismiss\" type=\"button\"><span class=\"screen-reader-text\">इस नोटिस को "
"खारिज करें।</span></button></div>"
#: admin-settings.php:30
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice."
"</span></button></div>"
msgstr ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>सेटिंग सहेजा नहीं।</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">इस नोटिस को खारिज "
"करें।</span></button></div>"
#: admin-settings.php:43
msgid "Duplicate Post Status"
msgstr "पोस्ट की स्थिति डुप्लिकेट"
#: admin-settings.php:50
msgid ""
"Please select any post status you want to assign for duplicate post. <strong>"
"Default:</strong> Draft."
msgstr ""
"कृपया किसी भी पोस्ट की स्थिति आप दोहरे पद के लिए प्रदान करना चाहते हैं का "
"चयन करें।<strong>चूक:</strong> प्रारूप।"
#: admin-settings.php:54
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr ""
"पर क्लिक करने के बाद पुन: निर्देशित करने के लिए <strong> डुप्लिकेट इस लिंक "
"</ strong>"
#: admin-settings.php:56
msgid "To All Posts List"
msgstr "सभी पदों की सूची के लिए"
#: admin-settings.php:57
msgid "To Duplicate Edit Screen"
msgstr "स्क्रीन संपादित करने के लिए डुप्लिकेट"
#: admin-settings.php:59
msgid ""
"Please select any post redirection, redirect you to selected after click on "
"duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
"कृपया किसी भी पद पुनर्निर्देशन का चयन करें, आप इस लिंक पर क्लिक करने के बाद "
"नकल चयनित करने के लिए भेज दें। <Strong> डिफ़ॉल्ट: </ strong> वर्तमान सूची पर।"
#: admin-settings.php:63
msgid "Duplicate Post Suffix"
msgstr "दोहरे पद प्रत्यय"
#: admin-settings.php:66
msgid ""
"Add a suffix for duplicate or clone post as Copy, Clone etc. It will show "
"after title."
msgstr ""
"कॉपी, क्लोन आदि के रूप में डुप्लिकेट या क्लोन के बाद यह खिताब के बाद दिखाएगा "
"के लिए एक प्रत्यय जोड़ें।"
#: admin-settings.php:76
msgid ""
"Contribute some donation, to make plugin more stable. You can pay amount of "
"your choice."
msgstr ""
"कुछ दान योगदान, प्लगइन अधिक स्थिर बनाने के लिए। आप अपनी पसंद की राशि का "
"भुगतान कर सकते हैं।"
#. Name of the plugin
msgid "Duplicate Page"
msgstr "डुप्लिकेट पृष्ठ"
#. Description of the plugin
msgid "Duplicate Posts, Pages and Custom Posts using single click."
msgstr "डुप्लिकेट पोस्ट, पन्ने और कस्टम पदों सिंगल क्लिक का उपयोग कर"
#. URI of the plugin
msgid "https://wordpress.org/plugins/duplicate-page/"
msgstr ""
#. Author of the plugin
msgid "mndpsingh287"
msgstr ""
#. Author URI of the plugin
msgid "https://profiles.wordpress.org/mndpsingh287/"
msgstr ""
@@ -0,0 +1,121 @@
# This file was generated by WPML
# WPML is a WordPress plugin that can turn any WordPress site into a full featured multilingual content management system.
# https://wpml.org
msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Project-Id-Version: WPML_EXPORT\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en\n"
"MIME-Version: 1.0\n"
"X-Generator: Poedit 2.0.4\n"
# <div class="wrap duplicate_page_settings">
# <h1><?php _e('Duplicate Page Settings', 'duplicate-page')?></h1>
# <?php $duplicatepageoptions = array();
msgid "Duplicate Page Settings"
msgstr ""
# if(isset($_POST['submit_duplicate_page']) && wp_verify_nonce( $_POST['duplicatepage_nonce_field'], 'duplicatepage_action' )):
# _e("<strong>Saving Please wait...</strong>", 'duplicate-page');
# $needToUnset = array('submit_duplicate_page');//no need to save in Database
msgid "<strong>Saving Please wait...</strong>"
msgstr ""
# if(!empty($msg) && $msg == 1):
# _e( '<div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
# <p><strong>Settings saved.</strong></p><button class="notice-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', 'duplicate-page');
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-error-settings_updated\"> \r\n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button></div>"
msgstr ""
# elseif(!empty($msg) && $msg == 2):
# _e( '<div class="error settings-error notice is-dismissible" id="setting-error-settings_updated">
# <p><strong>Settings not saved.</strong></p><button class="notice-dismiss" type="button"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', 'duplicate-page');
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-settings_updated\"> \r\n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice.</span></button></div>"
msgstr ""
# <tr>
# <th scope="row"><label for="duplicate_post_status"><?php _e('Duplicate Post Status', 'duplicate-page')?></label></th>
# <td><select id="duplicate_post_status" name="duplicate_post_status">
msgid "Duplicate Post Status"
msgstr ""
# </select>
# <p><?php _e('Please select any post status you want to assign for duplicate post. <strong>Default:</strong> Draft.', 'duplicate-page')?></p>
# </td>
msgid "Please select any post status you want to assign for duplicate post. <strong>Default:</strong> Draft."
msgstr ""
# <tr>
# <th scope="row"><label for="duplicate_post_redirect"><?php _e('Redirect to after click on <strong>Duplicate This Link</strong>', 'duplicate-page')?></label></th>
# <td><select id="duplicate_post_redirect" name="duplicate_post_redirect">
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr ""
# <td><select id="duplicate_post_redirect" name="duplicate_post_redirect">
# <option value="to_list" <?php echo($opt['duplicate_post_redirect'] == 'to_list' ) ? "selected = 'selected'" : ""; ?>><?php _e('To All Posts List', 'duplicate-page')?></option>
# <option value="to_page" <?php echo($opt['duplicate_post_redirect'] == 'to_page' ) ? "selected = 'selected'" : ""; ?>><?php _e('To Duplicate Edit Screen', 'duplicate-page')?></option>
msgid "To All Posts List"
msgstr ""
# <option value="to_list" <?php echo($opt['duplicate_post_redirect'] == 'to_list' ) ? "selected = 'selected'" : ""; ?>><?php _e('To All Posts List', 'duplicate-page')?></option>
# <option value="to_page" <?php echo($opt['duplicate_post_redirect'] == 'to_page' ) ? "selected = 'selected'" : ""; ?>><?php _e('To Duplicate Edit Screen', 'duplicate-page')?></option>
# </select>
msgid "To Duplicate Edit Screen"
msgstr ""
# </select>
# <p><?php _e('Please select any post redirection, redirect you to selected after click on duplicate this link. <strong>Default:</strong> To current list.', 'duplicate-page')?></p>
# </td>
msgid "Please select any post redirection, redirect you to selected after click on duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
# <tr>
# <th scope="row"><label for="duplicate_post_suffix"><?php _e('Duplicate Post Suffix', 'duplicate-page')?></label></th>
# <td>
msgid "Duplicate Post Suffix"
msgstr ""
# <input type="text" class="regular-text" value="<?php echo !empty($opt['duplicate_post_suffix']) ? $opt['duplicate_post_suffix'] : ''?>" id="duplicate_post_suffix" name="duplicate_post_suffix">
# <p><?php _e('Add a suffix for duplicate or clone post as Copy, Clone etc. It will show after title.', 'duplicate-page')?></p>
# </td>
msgid "Add a suffix for duplicate or clone post as Copy, Clone etc. It will show after title."
msgstr ""
# <div id="submitdiv" class="postbox" style="padding: 6px;">
# <p><strong style="color:#F00"><?php _e('Contribute some donation, to make plugin more stable. You can pay amount of your choice.', 'duplicate-page')?></strong></p>
# <form name="_xclick" action="https://www.paypal.com/yt/cgi-bin/webscr" method="post">
msgid "Contribute some donation, to make plugin more stable. You can pay amount of your choice."
msgstr ""
# if ( $file == plugin_basename( __FILE__ ) ) {
# $duplicate_page_links = '<a href="'.get_admin_url().'options-general.php?page=duplicate_page_settings">'.__('Settings', 'duplicate-page').'</a>';
# $duplicate_page_donate = '<a href="http://www.webdesi9.com/donate/?plugin=duplicate-page" title="Donate Now" target="_blank" style="font-weight:bold">'.__('Donate', 'duplicate-page').'</a>';
msgid "Settings"
msgstr ""
# $duplicate_page_links = '<a href="'.get_admin_url().'options-general.php?page=duplicate_page_settings">'.__('Settings', 'duplicate-page').'</a>';
# $duplicate_page_donate = '<a href="http://www.webdesi9.com/donate/?plugin=duplicate-page" title="Donate Now" target="_blank" style="font-weight:bold">'.__('Donate', 'duplicate-page').'</a>';
# array_unshift( $links, $duplicate_page_donate );
msgid "Donate"
msgstr ""
# public function duplicate_page_options_page(){
# add_options_page( __( 'Duplicate Page', 'duplicate-page' ), __( 'Duplicate Page', 'duplicate-page' ), 'manage_options', 'duplicate_page_settings',array(&$this, 'duplicate_page_settings'));
# }
msgid "Duplicate Page"
msgstr ""
# if (current_user_can('edit_posts')) {
# $actions['duplicate'] = '<a href="admin.php?action=dt_duplicate_post_as_draft&amp;post=' . $post->ID . '" title="Duplicate this as '.$post_status.'" rel="permalink">'.__( "Duplicate This", "duplicate-page" ).'</a>';
# }
msgid "Duplicate This"
msgstr ""
@@ -0,0 +1,125 @@
msgid ""
msgstr ""
"Project-Id-Version: Duplicate Page\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-19 12:43+0000\n"
"PO-Revision-Date: 2016-12-19 12:52+0000\n"
"Last-Translator: admin <munishthedeveloper48@gmail.com>\n"
"Language-Team: Hindi\n"
"Language: hi-IN\n"
"Plural-Forms: nplurals=2; plural=n != 1\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco - https://localise.biz/"
#: admin-settings.php:3
msgid "Duplicate Page Settings"
msgstr "डुप्लिकेट पृष्ठ सेटिंग"
#: admin-settings.php:8
msgid "<strong>Saving Please wait...</strong>"
msgstr "<strong>सुरक्षित कर रहा है कृपया प्रतीक्षा करें...</strong>"
#: admin-settings.php:27
msgid ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>Settings saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice."
"</span></button></div>"
msgstr ""
"<div class=\"updated settings-error notice is-dismissible\" id=\"setting-"
"error-settings_updated\"> \n"
"<p><strong>सेटिंग्स को सहेजा गया।</strong></p><button class=\"notice-"
"dismiss\" type=\"button\"><span class=\"screen-reader-text\">इस नोटिस को "
"खारिज करें।</span></button></div>"
#: admin-settings.php:30
msgid ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>Settings not saved.</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">Dismiss this notice."
"</span></button></div>"
msgstr ""
"<div class=\"error settings-error notice is-dismissible\" id=\"setting-error-"
"settings_updated\"> \n"
"<p><strong>सेटिंग सहेजा नहीं।</strong></p><button class=\"notice-dismiss\" "
"type=\"button\"><span class=\"screen-reader-text\">इस नोटिस को खारिज "
"करें।</span></button></div>"
#: admin-settings.php:43
msgid "Duplicate Post Status"
msgstr "पोस्ट की स्थिति डुप्लिकेट"
#: admin-settings.php:50
msgid ""
"Please select any post status you want to assign for duplicate post. <strong>"
"Default:</strong> Draft."
msgstr ""
"कृपया किसी भी पोस्ट की स्थिति आप दोहरे पद के लिए प्रदान करना चाहते हैं का "
"चयन करें।<strong>चूक:</strong> प्रारूप।"
#: admin-settings.php:54
msgid "Redirect to after click on <strong>Duplicate This Link</strong>"
msgstr ""
"पर क्लिक करने के बाद पुन: निर्देशित करने के लिए <strong> डुप्लिकेट इस लिंक "
"</ strong>"
#: admin-settings.php:56
msgid "To All Posts List"
msgstr "सभी पदों की सूची के लिए"
#: admin-settings.php:57
msgid "To Duplicate Edit Screen"
msgstr "स्क्रीन संपादित करने के लिए डुप्लिकेट"
#: admin-settings.php:59
msgid ""
"Please select any post redirection, redirect you to selected after click on "
"duplicate this link. <strong>Default:</strong> To current list."
msgstr ""
"कृपया किसी भी पद पुनर्निर्देशन का चयन करें, आप इस लिंक पर क्लिक करने के बाद "
"नकल चयनित करने के लिए भेज दें। <Strong> डिफ़ॉल्ट: </ strong> वर्तमान सूची पर।"
#: admin-settings.php:63
msgid "Duplicate Post Suffix"
msgstr "दोहरे पद प्रत्यय"
#: admin-settings.php:66
msgid ""
"Add a suffix for duplicate or clone post as Copy, Clone etc. It will show "
"after title."
msgstr ""
"कॉपी, क्लोन आदि के रूप में डुप्लिकेट या क्लोन के बाद यह खिताब के बाद दिखाएगा "
"के लिए एक प्रत्यय जोड़ें।"
#: admin-settings.php:76
msgid ""
"Contribute some donation, to make plugin more stable. You can pay amount of "
"your choice."
msgstr ""
"कुछ दान योगदान, प्लगइन अधिक स्थिर बनाने के लिए। आप अपनी पसंद की राशि का "
"भुगतान कर सकते हैं।"
#. Name of the plugin
msgid "Duplicate Page"
msgstr "डुप्लिकेट पृष्ठ"
#. Description of the plugin
msgid "Duplicate Posts, Pages and Custom Posts using single click."
msgstr "डुप्लिकेट पोस्ट, पन्ने और कस्टम पदों सिंगल क्लिक का उपयोग कर"
#. URI of the plugin
msgid "https://wordpress.org/plugins/duplicate-page/"
msgstr ""
#. Author of the plugin
msgid "mndpsingh287"
msgstr ""
#. Author URI of the plugin
msgid "https://profiles.wordpress.org/mndpsingh287/"
msgstr ""
#. Post link
msgid "Duplicate This"
msgstr ""
#. Post Link title (status as draft)
msgid "Duplicate this as draft"
msgstr ""
#. Post Link title (status as publish)
msgid "Duplicate this as publish"
msgstr ""
#. Post Link title (status as private)
msgid "Duplicate this as private"
msgstr ""
#. Post Link title (status as pending)
msgid "Duplicate this as pending"
msgstr ""
@@ -0,0 +1,253 @@
=== Duplicate Page ===
Contributors: mndpsingh287
Tags: Page Duplicate, Post duplicate, duplicate custom posts, duplicate page, duplicate post, duplicate ,custom posts, post, page, duplicate this, duplicate, content duplicate, duplicate content, data duplicate, duplicate data, copy page, clone page,wordpress page duplicate, wordpress post duplicate, Copy post, wordpress page duplicator, wordpress post duplicator, Cloner, duplicate post
Requires at least: 3.4
Tested up to: 6.9.4
Stable tag: 4.5.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Duplicate Posts, Pages and Custom Posts easily using single click
== Description ==
Duplicate Posts, Pages and Custom Posts easily using single click. You can duplicate your pages, posts and custom post by just one click and it will save as your selected options (draft, private, public, pending).
= Key Features in Duplicate Page Pro Editions =
* **User Roles:** Allow User Roles To access Duplicate Page.
* **Post Types:** Filter to show Duplicate Page link in post types.
* **Clone Link Location:** Option where to show clone link.
* **Status:** Option to select Duplicate Posts Status.
* **Redirection:** Option to Redirect after click on clone link..
* **Clone Link Title:** Option to change Duplicate Post Link Title.
* **Post Prefix:** Option to add Post Prefix.
* **Post Suffix:** Option to add Post Suffix.
* **Editor**: And Many More Filters and Features.
> <strong>[Buy Pro Version](https://duplicatepro.com/pro/?utm_source=Wordpress.org&utm_medium=Website&utm_campaign=Duplicate%20Page%20Pro)</strong> with various features & support.
> <strong>[Contact us](https://duplicatepro.com/contact/?utm_source=Wordpress.org&utm_medium=Website&utm_campaign=Duplicate%20Page%20Pro)</strong> for Support Only Pro Version Users.
**[Upgrade to Pro Version](https://duplicatepro.com/pro/?utm_source=Wordpress.org&utm_medium=Website&utm_campaign=Duplicate%20Page%20Pro)**
https://www.youtube.com/watch?v=Fj8BHxvebXs&feature=youtu.be
== Installation ==
1. Upload the `duplicate-page` folder to the directory `/wp-content/plugins/`.
2. Activate the plugin using the 'Plugins' menu in WordPress.
== Frequently asked questions ==
## How to use
1. First Activate Plugin.
2. Go Select to Duplicate Page settings Menu from Settings Tab and savings settings.
1. Then Create New Post/Page or Use old.
2. After click on duplicate this link, then duplicate post/ page will be created and saved as draft,publish,pending,private depending upon settings.
== Screenshots ==
1. Activate Screen
2. Duplicate Page Settings Screen
3. Select Option from Settings Page.
4. Click on Duplicate This.
5. Duplicate Post / Page will Appear.
== Changelog ==
= 4.5.9 (8th May, 2026) =
* Security Fix: Replaced role-based check (contributor) with capability-based check (edit_posts) per WordPress coding standards.
* Bug Fix: Resolved Elementor and page builder layout not preserved after duplication.
* Bug Fix: Switched from add_post_meta() to update_post_meta() to prevent duplicate meta entries on duplicated posts.
* Bug Fix: Added wp_slash() to meta values before saving to prevent double-unslashing which corrupted page builder JSON data.
= 4.5.8 (21st Apr, 2026) =
* Security fixes
= 4.5.7 (2nd March, 2026) =
* Compatible with WordPress 6.9.4
= 4.5.6 (16th Oct, 2025) =
* Compatible with WordPress 6.8.3
= 4.5.5 (9th June, 2025) =
* Compatible with WordPress 6.8.1
= 4.5.4 (29th July, 2024) =
* Compatible with WordPress 6.6.1
= 4.5.3(11th Sept, 2023)
* Compatible with wordpress 6.3.1
= 4.5.2(4th May, 2023)
* Compatible with wordpress 6.2
= 4.5.1(8th Feb, 2023)
* Fixes compatibility issues with event calendar plugin.
* Minor bug fixes
= 4.5(14th Dec, 2022)
* Checked compatibility with wordpress v6.1.1
* Fixes elementor sections compatibility issue
= 4.4.9(15th Jul, 2022)
* Checked compatibility with wordpress v6.0.1
= 4.4.8(27th Jan, 2022)
* Checked compatibility with wordpress v5.9
= 4.4.7(16th Dec, 2021)
* Added editor role check
= 4.4.6(7th Dec, 2021)
* Fixed security issues.
= 4.4.5(29th Sep, 2021)
* Fixed the issue for content HTML displaying in the sidebar.
= 4.4.4(16th Sep, 2021)
* Fixed sanitization Issues as per wordpress standards.
= 4.4.3(8th Sep, 2021)
* Updated code sanitization process for secure data submission
= 4.4.2(6th Sep, 2021)
* Added sanitization as per wordpress standards.
= 4.4.1(27th July, 2021) =
* Checked compatibility with wordpress v5.8
* Fixed php warnings
= 4.4(18th Mar, 2021) =
* Tested upto wordpress v5.7
= 4.3(28th Aug, 2020) =
* Tested with wordpress v5.5
= 4.2(26th March, 2020) =
* Fixed Translations string issue
= 4.1(20th Feb, 2020) =
* Fixed Translations issue
= 4.0(20th Sep, 2019) =
* Fixed slug duplication issue
= 3.9 (6th Aug, 2019) =
* Fixed some compatibility issues
= 3.8 (18th July, 2019) =
* Fixed compatibility issues with GT3 editor
= 3.7 (18th July, 2019) =
* Fixed compatibility issues with other editors
= 3.6 (16th July, 2019) =
* Security fixes addressed by wordpress
= 3.5 (2nd Apr, 2019) =
* Gutenberg and advanced custom fields compatibility
= 3.4 (1st Apr, 2019) =
* Security issues fixes addressed by Securi
= 3.3 (14th March, 2019) =
* Compatible with WordPress 5.1.1
= 3.2 (25th Dec, 2018) =
* Gutenberg Compatible
= 3.1 (5th Dec, 2018) =
* removed nag
= 3.0 (3rd Dec, 2018) =
* German Formal lang added
= 2.9 (16th Nov, 2018) =
* Minor bug fixes
= 2.8 (20th Oct, 2018) =
* Compatible with php 7.3 and wordpress 5.0
= 2.7 (28th July, 2018) =
* removed useless adsense code
= 2.6 (24th March, 2018) =
* Added signup popup and minor fixes.
= 2.5 (5th Feb, 2018) =
* Translations issue resolve.
= 2.4 (29th Nov, 2017) =
* Duplicate Page appends original post name issue fixed.
= 2.3 (27st april, 2017) =
* Minor Fixes
= 2.2 (28th Jan, 2017) =
* Strings Translations
= 2.1 (25th Aug, 2016) =
* New Text field added in settings page for duplicate post title suffix to remove confusion of currently duplicate page.
= 1.4 (18th Jun, 2016) =
* New Features added
= 1.3 (23th May, 2016) =
* New Features added
= 1.2 (05th May, 2016) =
* Duplicate Page Settings Menu Added.
= 1.1 (04th May ,2016) =
* fix some Bug in 1.0
== Other Notes ==
== Minimum requirements for Duplicate Page ==
* Wordpress 3.3+
* PHP 5.x
* MySQL 5.x
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,475 @@
/* languages admin panel */
#add-lang select {
width: 95%;
}
#add-lang label {
margin: 0.35em 0 0.5em;
}
.pll-legend {
display: block;
padding: 2px 0;
color: #1d2327;
font-weight: 400;
text-shadow: none;
margin: 0.35em 0 0.5em;
}
.column-locale,
.languages .column-slug {
width : 15%
}
.column-default_lang {
width : 5%;
}
.column-term_group,
.column-flag, .column-count {
width : 10%;
}
td.column-default_lang .icon-default-lang:before,
.pll-wizard-content .icon-default-lang:before {
font-family: 'dashicons';
content: "\f155";
}
.pll-icon:before{
display: inline-block;
text-align: left;
width: 15px;
}
.pll-circle:before{
content: "\25cf";
}
/* about Polylang metabox */
#pll-about-box p,
#pll-recommended p {
text-align: justify;
}
#pll-about-box input {
margin: 0;
padding: 0;
float: right;
}
/* strings translation table */
.stringstranslations .column-name,
.stringstranslations .column-context {
width: 10%;
}
.stringstranslations .column-string {
width: 33%;
}
.translation label {
display: inline-block;
width: 23%;
vertical-align: top;
}
.translation {
display: flex; /* fix #691 to remove default margin bottom */
}
@media screen and (max-width: 782px) { /* reset default display property for small device */
.translation{
display: block;
}
}
.translation textarea{
display: block; /* fix #691 to remove default margin bottom */
}
.translation input,
.translation textarea {
width: 72%;
box-sizing: border-box; /* to be sure field don't overrun outside their wrapper */
margin-bottom: 4px; /* fix #691 set the same margin bottom for both textarea and input tags */
}
/* settings */
.pll-settings {
margin-top: 20px;
}
.pll-settings .plugin-title {
width: 25%;
}
#wpbody-content .pll-settings .pll-configure tr {
display: table-row;
}
#wpbody-content .pll-settings .pll-configure td {
display: table-cell;
}
#wpbody-content .pll-settings .pll-configure > td {
padding: 20px 20px 20px 40px;
}
.pll-configure legend {
font-size: 14px;
font-weight: 600;
margin-bottom: 0.5em;
}
.pll-configure td .description {
margin-top: 2px;
margin-bottom: 0.5em;
}
.pll-configure p.submit {
margin-top: 20px;
}
.pll-configure .button {
margin-right: 20px;
}
.pll-configure fieldset {
margin-bottom: 1.5em;
}
.pll-inline-block-list {
margin: 0;
}
.pll-inline-block-list li {
display: inline-block;
margin: 0;
width: 250px;
}
/* settings URL modifications */
#pll-domains-table td {
padding: 2px 2px 2px 1.5em;
-webkit-box-shadow: none;
box-shadow: none;
border: none;
}
.pll-settings-url-col {
display: inline-block;
width: 49%;
vertical-align: top;
}
/* settings Activation keys */
.pll-table-top td {
vertical-align: top;
}
#pll-licenses-table label {
font-size: 1em;
font-weight: 600;
}
.pll-configure .pll-deactivate-license {
margin: 0 0 0 20px;
}
/* language columns in edit.php and edit-tags.php */
.wp-list-table th[class*='column-language_'],
.wp-list-table td[class*='column-language_'] {
width: 1.5em;
box-sizing: content-box; /* Override ACF 5.9.0 styles */
}
/* Text direction in post.php and edit-tags.php */
.pll-dir-rtl textarea,
.pll-dir-rtl input[type="text"] {
direction: rtl;
}
.pll-dir-ltr textarea,
.pll-dir-ltr input[type="text"] {
direction: ltr;
}
.pll-dir-ltr .tr_lang,
.pll-dir-rtl .tr_lang {
direction: inherit;
}
/* languages metabox in post.php */
#ml_box p {
margin-top: 1em;
}
#post-translations p {
float: left;
margin-top: 1em;
}
.rtl #post-translations p {
float: right;
}
#post-translations table {
table-layout: fixed;
width: 100%;
clear: both;
}
#post-translations a {
text-decoration: none;
}
#post-translations .pll-language-column,
#post-translations .pll-column-icon {
width: 20px;
}
#post-translations .tr_lang {
width: 100%;
}
#post-translations td {
padding: 2px;
}
#post-translations .spinner,
#term-translations .spinner {
float: none;
margin: 0;
background-position: center;
width: auto;
}
#select-post-language .pll-select-flag {
padding: 4px;
margin-right: 10px;
}
.rtl #select-post-language .pll-select-flag {
padding: 4px;
margin-right: 0px;
margin-left: 10px;
}
/* specific cases for media */
#select-media-language .pll-select-flag {
padding: 4px;
margin-right: 10px;
}
.pll-media-edit-column {
float: right;
}
/* language and translations in edit-tags.php */
.pll-translation-flag { /* also for media */
margin-right: 14px;
}
#select-add-term-language .pll-select-flag {
padding: 11px;
margin-right: 13px;
}
#select-edit-term-language .pll-select-flag {
padding: 11px;
margin-right: 4px;
}
#term-translations p {
/* same style as label */
font-weight: 400;
font-style: normal;
padding: 2px;
color: #23282d;
}
#add-term-translations,
#edit-term-translations {
width: 95%;
}
#term-translations .pll-language-column {
line-height: 28px;
width: 20%;
}
#term-translations .pll-edit-column,
#add-term-translations .pll-language-column {
width: 20px;
}
#edit-term-translations .pll-language-column {
padding: 15px 10px;
font-weight: normal;
}
/* icon fonts */
.pll_icon_add:before {
content: "\f132";
}
.pll_icon_edit:before {
content: "\f464";
}
[class^="pll_icon_"] {
font: 20px/1 'dashicons';
vertical-align: middle;
}
/* admin bar */
#wpadminbar #wp-admin-bar-languages .ab-item img {
margin: 0 8px 0 2px;
}
#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon {
float: none;
top: 4px;
}
#wpadminbar #wp-admin-bar-languages .ab-icon:before {
content: "\f326";
top: 1px;
}
#wp-admin-bar-languages.pll-filtered-languages {
background-color:var(--wp-admin-theme-color);
}
.admin-color-coffee #wp-admin-bar-languages.pll-filtered-languages {
background-color: #c7a589;
}
.admin-color-ectoplasm #wp-admin-bar-languages.pll-filtered-languages {
background-color: #a3b745;
}
.admin-color-light #wp-admin-bar-languages.pll-filtered-languages {
background-color: #888;
}
.admin-color-light #wpadminbar #wp-admin-bar-languages.pll-filtered-languages span.ab-label {
color: #fff;
}
.admin-color-ocean #wp-admin-bar-languages.pll-filtered-languages {
background-color: #9ebaa0;
}
/* Notices */
.pll-notice.notice {
padding-right: 38px;
position: relative;
}
.pll-notice a.notice-dismiss {
text-decoration: none;
}
.pll-notice .button {
margin-right: 10px;
}
@media screen and ( max-width: 782px ) {
/* settings */
#wpbody-content .pll-settings .pll-configure > td {
padding: 20px;
}
#wpbody-content .pll-settings #cb {
padding: 20px 9px;
}
/* settings URL modifications */
.pll-inline-block {
width: auto;
}
.pll-settings-url-col {
display: block;
width: 100%;
}
/* settings licenses */
#wpbody-content .pll-settings #pll-licenses-table td {
display: block;
}
.pll-configure .pll-deactivate-license {
margin: 10px 0 5px;
}
/* strings translations table */
.translation label {
display: block;
width: 95%;
padding-left: 0;
}
.translation input,
.translation textarea {
width: 95%;
}
/* hide selected language flag and translations language name */
#select-add-term-language .pll-select-flag,
#select-edit-term-language .pll-select-flag,
#edit-term-translations .pll-language-name {
display: none;
}
#edit-term-translations {
width: 100%;
}
#add-term-translations .pll-language-column {
line-height: 38px;
}
#edit-term-translations td {
padding: 8px 10px;
}
#edit-term-translations .pll-language-column,
#edit-term-translations .pll-edit-column {
width: 20px;
}
/* translations tables should be kept as table */
.term-translations .pll-language-column,
.term-translations .pll-edit-column,
.term-translations .pll-translation-column {
display: table-cell;
}
.term-translations .hidden {
display: none;
}
/* admin bar */
#wpadminbar #wp-admin-bar-languages {
display: block; /*shows our menu on mobile devices */
}
#wpadminbar #wp-admin-bar-languages > .ab-item {
width: 50px;
text-align: center;
}
#wpadminbar #wp-admin-bar-languages > .ab-item .ab-icon:before {
font: 32px/1 'dashicons';
top: -1px;
}
#wpadminbar #wp-admin-bar-languages > .ab-item img {
margin: 19px 0;
}
#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon {
margin-right: 6px;
font-size: 20px !important;
line-height: 20px !important;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,57 @@
.bulk-translate-save .button {
margin-right: 20px;
}
#wpbody-content #pll-translate .pll-bulk-translate-fields-wrapper {
display: flex;
}
#wpbody-content #pll-translate fieldset {
flex-basis: fit-content;
margin-right: 10%;
}
#pll-translate .pll-translation-flag {
margin: auto 10px auto 7px;
}
.rtl #pll-translate .pll-translation-flag {
margin: auto 7px auto 10px;
}
#pll-translate .title {
display: block;
line-height: 2.5;
}
#pll-translate label {
display: flex;
align-items: center;
}
#pll-translate label span.description{
line-height: normal;
}
#pll-translate label[for="pll-select-format"] {
padding-left: 18px;
}
#pll-translate #pll-select-format {
margin-left: 0.5rem;
}
@supports(selector(:has(*))) {
#pll-translate label[for="pll-select-format"] {
display: none;
}
#pll-translate label:has([name="translate"][value="pll_export_post"]:checked) ~ [for="pll-select-format"] {
display: flex;
}
}
@media screen and ( max-width: 782px ) {
#wpbody-content #pll-translate .pll-bulk-translate-fields-wrapper {
flex-direction: column;
}
}
@@ -0,0 +1 @@
.bulk-translate-save .button{margin-right:20px}#wpbody-content #pll-translate .pll-bulk-translate-fields-wrapper{display:flex}#wpbody-content #pll-translate fieldset{flex-basis:fit-content;margin-right:10%}#pll-translate .pll-translation-flag{margin:auto 10px auto 7px}.rtl #pll-translate .pll-translation-flag{margin:auto 7px auto 10px}#pll-translate .title{display:block;line-height:2.5}#pll-translate label{align-items:center;display:flex}#pll-translate label span.description{line-height:normal}#pll-translate label[for=pll-select-format]{padding-left:18px}#pll-translate #pll-select-format{margin-left:.5rem}@supports(selector(:has(*))){#pll-translate label[for=pll-select-format]{display:none}#pll-translate label:has([name=translate][value=pll_export_post]:checked)~[for=pll-select-format]{display:flex}}@media screen and (max-width:782px){#wpbody-content #pll-translate .pll-bulk-translate-fields-wrapper{flex-direction:column}}
@@ -0,0 +1,85 @@
/* By default Polylang dialog box use WordPress jQuery UI dialog styles.
However WooCommerce loads its own jQuery UI dialog styles and we need to override them by ours
to revert to the default WordPress ones.
*/
.pll-confirmation-modal.ui-widget,
.pll-confirmation-modal.ui-widget .ui-widget,
.pll-confirmation-modal .ui-widget {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
}
.pll-confirmation-modal.ui-dialog {
padding: 0;
z-index: 100102;
background: #fff;
border: 0;
color: #444;
border-radius: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar {
background: #fcfcfc;
border-radius: 0;
border: 0;
border-bottom: 1px solid #dfdfdf;
height: 36px;
font-size: 18px;
font-weight: 600;
line-height: 2;
padding: 0 36px 0 16px;
color: #444;
position: static;
}
.ui-dialog.pll-confirmation-modal .ui-dialog-title {
float: none;
width: auto;
margin: 0;
}
.pll-confirmation-modal .ui-widget-header .ui-icon {
background: none;
position: static;
}
.pll-confirmation-modal .ui-button.ui-dialog-titlebar-close {
padding: 0;
margin: 0;
top: 0;
right: 0;
width: 36px;
height: 36px;
border: 0; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
background: none; /* Override WooCommerce dialog styles - jQuery UI 1.11.4 - WP < 5.6 */
}
.ui-dialog.pll-confirmation-modal .ui-dialog-content {
border: 0;
padding: 16px;
color: #444;
position: static;
box-sizing: border-box;
}
.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane{
margin: 0;
padding: 16px;
border: 0;
background: #fcfcfc;
border-top: 1px solid #dfdfdf;
}
.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane .ui-button{
margin: 0 0 0 16px;
padding: 0 10px 1px;
background: #f7f7f7;
border: 1px solid #cccccc;
border-radius: 3px;
position: static;
line-height: 2;
vertical-align: top;
}
.ui-dialog.pll-confirmation-modal .ui-button:hover,
.ui-dialog.pll-confirmation-modal .ui-button:focus {
background: #fafafa;
border-color: #999;
color: #23282d;
}
.pll-confirmation-modal + .ui-widget-overlay {
background: #000;
opacity: 0.7;
z-index: 100101;
}
@@ -0,0 +1 @@
.pll-confirmation-modal .ui-widget,.pll-confirmation-modal.ui-widget,.pll-confirmation-modal.ui-widget .ui-widget{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.pll-confirmation-modal.ui-dialog{background:#fff;border:0;border-radius:0;color:#444;padding:0;z-index:100102}.ui-dialog.pll-confirmation-modal .ui-dialog-titlebar{background:#fcfcfc;border:0;border-bottom:1px solid #dfdfdf;border-radius:0;color:#444;font-size:18px;font-weight:600;height:36px;line-height:2;padding:0 36px 0 16px;position:static}.ui-dialog.pll-confirmation-modal .ui-dialog-title{float:none;margin:0;width:auto}.pll-confirmation-modal .ui-widget-header .ui-icon{background:none;position:static}.pll-confirmation-modal .ui-button.ui-dialog-titlebar-close{background:none;border:0;height:36px;margin:0;padding:0;right:0;top:0;width:36px}.ui-dialog.pll-confirmation-modal .ui-dialog-content{border:0;box-sizing:border-box;color:#444;padding:16px;position:static}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane{background:#fcfcfc;border:0;border-top:1px solid #dfdfdf;margin:0;padding:16px}.ui-dialog.pll-confirmation-modal .ui-dialog-buttonpane .ui-button{background:#f7f7f7;border:1px solid #ccc;border-radius:3px;line-height:2;margin:0 0 0 16px;padding:0 10px 1px;position:static;vertical-align:top}.ui-dialog.pll-confirmation-modal .ui-button:focus,.ui-dialog.pll-confirmation-modal .ui-button:hover{background:#fafafa;border-color:#999;color:#23282d}.pll-confirmation-modal+.ui-widget-overlay{background:#000;opacity:.7;z-index:100101}
@@ -0,0 +1,102 @@
.pll-settings .pll-inner-notice {
margin: 5px 0 15px;
border: 1px solid #c3c4c7;
border-left-width: 4px;
padding: 1px 12px;
background: #fff;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.form-table .pll-inner-notice {
margin-bottom: 5px;
}
.pll-settings .notice-success {
border-left-color: #00a32a;
}
.pll-settings .notice-warning {
border-left-color: #dba617;
}
.pll-settings .notice-error {
border-left-color: #d63638;
}
.pll-settings .pll-inner-notice p {
margin: 0.5em 0;
padding: 2px;
}
.pll-settings .pll-message:not(.pll-origin-message),
.pll-settings .notice-success .pll-origin-message,
.pll-settings .notice-warning .pll-origin-message,
.pll-settings .notice-error .pll-origin-message {
display: none;
}
.pll-settings .notice-success .pll-success-message,
.pll-settings .notice-warning .pll-warning-message.pll-message-shown,
.pll-settings .notice-error .pll-error-message.pll-message-shown {
display: block;
}
.pll-settings [disabled] + .spinner,
.pll-progress-bar-wrapper .spinner {
visibility: visible;
}
.pll-success-message .pll-icon {
color: rgb(18, 91, 145);
}
.pll-error-message .pll-icon,
.pll-warning-message .pll-icon {
color: rgb(145, 30, 31);
}
.pll-icon {
font-size: 1.8em;
margin-right: 3px;
margin-left: 1px;
vertical-align: -2px;
}
.pll-progress-bar-wrapper {
position: relative;
max-width: 500px;
height: 2em;
line-height: 2em;
vertical-align: middle;
text-align: left;
font-size: 2em;
border: 1px solid rgb(64, 70, 72);
border-radius: 4px;
overflow: hidden;
white-space: nowrap;
color: rgb(23, 114, 181);
text-indent: 1em;
}
.pll-progress-bar-wrapper div {
position: absolute;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
background-color: rgb(23, 114, 181);
color: rgb(232, 230, 227);
}
.pll-settings [type="password"] + .button {
margin-left: 20px;
margin-right: 0;
}
.pll-settings .pll-spinner-inline {
float: none;
}
.pll-progress-bar-wrapper .spinner {
margin: 0;
}
@@ -0,0 +1 @@
.pll-settings .pll-inner-notice{background:#fff;border:1px solid #c3c4c7;border-left-width:4px;box-shadow:0 1px 1px rgba(0,0,0,.04);margin:5px 0 15px;padding:1px 12px}.form-table .pll-inner-notice{margin-bottom:5px}.pll-settings .notice-success{border-left-color:#00a32a}.pll-settings .notice-warning{border-left-color:#dba617}.pll-settings .notice-error{border-left-color:#d63638}.pll-settings .pll-inner-notice p{margin:.5em 0;padding:2px}.pll-settings .notice-error .pll-origin-message,.pll-settings .notice-success .pll-origin-message,.pll-settings .notice-warning .pll-origin-message,.pll-settings .pll-message:not(.pll-origin-message){display:none}.pll-settings .notice-error .pll-error-message.pll-message-shown,.pll-settings .notice-success .pll-success-message,.pll-settings .notice-warning .pll-warning-message.pll-message-shown{display:block}.pll-progress-bar-wrapper .spinner,.pll-settings [disabled]+.spinner{visibility:visible}.pll-success-message .pll-icon{color:#125b91}.pll-error-message .pll-icon,.pll-warning-message .pll-icon{color:#911e1f}.pll-icon{font-size:1.8em;margin-left:1px;margin-right:3px;vertical-align:-2px}.pll-progress-bar-wrapper{border:1px solid #404648;border-radius:4px;color:#1772b5;font-size:2em;height:2em;line-height:2em;max-width:500px;overflow:hidden;position:relative;text-align:left;text-indent:1em;vertical-align:middle;white-space:nowrap}.pll-progress-bar-wrapper div{background-color:#1772b5;color:#e8e6e3;height:100%;left:0;overflow:hidden;position:absolute;top:0}.pll-settings [type=password]+.button{margin-left:20px;margin-right:0}.pll-settings .pll-spinner-inline{float:none}.pll-progress-bar-wrapper .spinner{margin:0}
@@ -0,0 +1,25 @@
.pll-button {
padding: 0;
height: 20px;
background: none;
border: none;
font-size: 20px;
cursor: pointer;
}
.pll-button:not(.wp-ui-text-highlight) {
color: #DDDDDD;
}
.pll-button svg {
fill: currentColor;
}
.pll-before-post-translations-button {
float: right;
margin: 13px 7px;
}
.rtl .pll-before-post-translations-button {
float: left;
}
@@ -0,0 +1 @@
.pll-button{background:none;border:none;cursor:pointer;font-size:20px;height:20px;padding:0}.pll-button:not(.wp-ui-text-highlight){color:#ddd}.pll-button svg{fill:currentColor}.pll-before-post-translations-button{float:right;margin:13px 7px}.rtl .pll-before-post-translations-button{float:left}
@@ -0,0 +1,3 @@
.wp-block-polylang-navigation-language-switcher a:not(:first-child) {
margin-left: 1rem;
}
@@ -0,0 +1 @@
.wp-block-polylang-navigation-language-switcher a:not(:first-child){margin-left:1rem}
@@ -0,0 +1,239 @@
/* Greatly modified version of the jquery-ui.css */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-menu {
list-style: none;
padding: 0;
margin: 0;
display: block;
outline: none;
}
.ui-menu .ui-menu {
position: absolute;
}
.ui-menu .ui-menu-item {
position: relative;
margin: 0;
padding: 3px 1em 3px .4em;
cursor: pointer;
min-height: 0; /* support: IE7 */
/* support: IE10, see #8844 */
list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
}
/* for jQuery UI 1.12 which introduces a wrapper */
.ui-menu .ui-menu-item:not([role]) {
padding: 0;
}
.ui-menu-item-wrapper {
padding: 3px 1em 3px 2em;
}
.rtl .ui-menu .ui-menu-item {
text-align: right;
}
/* icon support */
.ui-menu-icons {
position: relative;
}
.ui-menu-icons .ui-menu-item[role] {
padding-left: 2em;
}
.rtl .ui-menu-item-wrapper, /* for jQuery UI 1.12 which introduces a wrapper */
.rtl .ui-menu-icons .ui-menu-item[role] {
padding-left: 1em;
padding-right: 2em;
}
/* left-aligned */
.ui-selectmenu-text .ui-icon,
.ui-menu .ui-icon {
position: absolute;
top: 0;
bottom: 0;
left: .3em;
margin: auto 0;
}
.rtl .ui-selectmenu-text .ui-icon,
.rtl .ui-menu .ui-icon {
right: .3em;
left: auto;
}
/* right-aligned */
.ui-menu .ui-menu-icon {
left: auto;
right: 0;
}
.ui-selectmenu-menu {
padding: 0;
margin: 0;
position: absolute;
top: 0;
left: 0;
display: none;
}
.ui-selectmenu-menu .ui-menu {
overflow: auto;
/* Support: IE7 */
overflow-x: hidden;
padding-bottom: 1px;
}
.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
font-size: 1em;
font-weight: bold;
line-height: 23px;
padding: 2px 0.4em;
margin: 0.5em 0 0 0;
height: auto;
border: 0;
}
.ui-selectmenu-open {
display: block;
}
.ui-selectmenu-button, /* jQuery UI 1.11.4 - WP < 5.6 */
.ui-selectmenu-button.ui-button {
display: inline-block;
overflow: hidden;
position: relative;
text-decoration: none;
box-sizing: border-box; /* To keep width calculation in percent since WP 5.6 */
text-align: left;
white-space: nowrap;
vertical-align: top;
padding: 0;
line-height: normal; /* Override WC Bookings styles with WP < 5.6 */
height: 28px; /* Override WC Bookings styles with WP < 5.6 */
}
.ui-selectmenu-button span.ui-icon {
right: 0.5em;
left: auto;
position: absolute;
top: 26%;
width: 16px;
height: 16px;
text-indent: 0; /* due to text-indent for jquery ui-dialog in wizard */
background: none;
}
.rtl .ui-selectmenu-button span.ui-icon {
left: 0.5em;
right: auto;
}
.ui-selectmenu-button.ui-widget span.ui-selectmenu-text, /* Override WC Bookings styles with WP < 5.6 */
.ui-selectmenu-button span.ui-selectmenu-text {
text-align: left;
padding: 0.1em 2.1em 0.2em 2em;
display: block;
line-height: 23px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0;
}
.rtl .ui-selectmenu-button span.ui-selectmenu-text {
text-align: right;
padding: 0.2em 2em 0.2em 2.1em;
}
.ui-widget-content,
.ui-state-default,
.ui-selectmenu-button.ui-state-default, /* Override WC Bookings styles with WP < 5.6 */
.ui-button.ui-selectmenu-button-closed, /* To be compatible jQuery UI 1.12.1 since WordPress 5.6 */
.ui-button.ui-selectmenu-button-open, /* To be compatible jQuery UI 1.12.1 since WordPress 5.6 */
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
background: #fff;
border: 1px solid #ddd;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
color: #32373c;
}
/* Override to have same styles as WP form styles since WordPress 5.4 */
.languages_page_mlang .ui-selectmenu-button.ui-state-default,
.languages_page_mlang .ui-selectmenu-button.ui-selectmenu-button-closed, /* To be compatible jQuery UI 1.12.1 since WordPress 5.6 */
.languages_page_mlang .ui-selectmenu-button.ui-selectmenu-button-open{ /* To be compatible jQuery UI 1.12.1 since WordPress 5.6 */
box-shadow: 0 0 0 transparent;
border-radius: 4px;
border: 1px solid #7e8993;
}
/* From this line and below: override WooCommerce bookings plugin styles which overrides default WordPress styles */
.pll-selectmenu-menu .ui-widget,
.pll-selectmenu-button.ui-widget {
font-size: 13px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
.languages_page_mlang .ui-button.ui-selectmenu-button:focus{
color: #016087; /* Same color as WordPress focused select HTML tag */
border-color: #007cba;
box-shadow: 0 0 0 1px #007cba;
outline: 2px solid transparent;
background: #fff; /* Override bookings plugin styles which overrides default WordPress styles */
}
.languages_page_mlang .ui-menu-item,
.languages_page_mlang .ui-widget-content .ui-state-hover,
.languages_page_mlang .ui-widget-content .ui-state-focus,
.languages_page_mlang .ui-widget-content .ui-state-active {
color: #016087; /* Same color as option in a WordPress focused select HTML tag */
margin: 0;
}
.ui-selectmenu-open .ui-widget-content .ui-state-hover, /* Override WC Bookings styles with WP < 5.6 */
.ui-selectmenu-open .ui-widget-content .ui-state-focus, /* Override WC Bookings styles with WP < 5.6 */
.ui-selectmenu-open .ui-widget-content .ui-state-active, /* Override WC Bookings styles with WP < 5.6 */
.pll-selectmenu-menu .ui-widget-content .ui-state-hover,
.pll-selectmenu-menu .ui-widget-content .ui-state-focus,
.pll-selectmenu-menu .ui-widget-content .ui-state-active { /* To be compatible jQuery UI 1.12.1 since WordPress 5.6 */
background: #d5d5d5;
border: 0;
}
.ui-selectmenu-button.ui-state-focus {
border: 1px solid #5b9dd9;
box-shadow: 0 0 2px rgba(30, 140, 190, 0.8);
}
.ui-icon-triangle-1-s:before {
content: "";
background: #fff url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E) no-repeat right 0px top 55%;
background-size: 16px 16px;
box-sizing: border-box;
position: absolute;
width: 16px;
height: 16px;
}
.pll-selectmenu-button.ui-button:hover,
.pll-wizard .ui-button:hover,
.pll-wizard .ui-button:focus {
background: #fff; /* To override jQuery ui-dialog styles provided by WordPress */
}
.ui-widget-content {
max-height: 231px;
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
@@ -0,0 +1 @@
.ui-widget-overlay{height:100%;left:0;position:fixed;top:0;width:100%}.ui-menu{display:block;list-style:none;margin:0;outline:none;padding:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{cursor:pointer;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);margin:0;min-height:0;padding:3px 1em 3px .4em;position:relative}.ui-menu .ui-menu-item:not([role]){padding:0}.ui-menu-item-wrapper{padding:3px 1em 3px 2em}.rtl .ui-menu .ui-menu-item{text-align:right}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item[role]{padding-left:2em}.rtl .ui-menu-icons .ui-menu-item[role],.rtl .ui-menu-item-wrapper{padding-left:1em;padding-right:2em}.ui-menu .ui-icon,.ui-selectmenu-text .ui-icon{bottom:0;left:.3em;margin:auto 0;position:absolute;top:0}.rtl .ui-menu .ui-icon,.rtl .ui-selectmenu-text .ui-icon{left:auto;right:.3em}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-selectmenu-menu{display:none;left:0;margin:0;padding:0;position:absolute;top:0}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{border:0;font-size:1em;font-weight:700;height:auto;line-height:23px;margin:.5em 0 0;padding:2px .4em}.ui-selectmenu-open{display:block}.ui-selectmenu-button,.ui-selectmenu-button.ui-button{box-sizing:border-box;display:inline-block;height:28px;line-height:normal;overflow:hidden;padding:0;position:relative;text-align:left;text-decoration:none;vertical-align:top;white-space:nowrap}.ui-selectmenu-button span.ui-icon{background:none;height:16px;left:auto;position:absolute;right:.5em;text-indent:0;top:26%;width:16px}.rtl .ui-selectmenu-button span.ui-icon{left:.5em;right:auto}.ui-selectmenu-button span.ui-selectmenu-text,.ui-selectmenu-button.ui-widget span.ui-selectmenu-text{display:block;line-height:23px;margin:0;overflow:hidden;padding:.1em 2.1em .2em 2em;text-align:left;text-overflow:ellipsis;white-space:nowrap}.rtl .ui-selectmenu-button span.ui-selectmenu-text{padding:.2em 2em .2em 2.1em;text-align:right}.ui-button.ui-selectmenu-button-closed,.ui-button.ui-selectmenu-button-open,.ui-selectmenu-button.ui-state-default,.ui-state-default,.ui-widget-content,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{background:#fff;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);color:#32373c}.languages_page_mlang .ui-selectmenu-button.ui-selectmenu-button-closed,.languages_page_mlang .ui-selectmenu-button.ui-selectmenu-button-open,.languages_page_mlang .ui-selectmenu-button.ui-state-default{border:1px solid #7e8993;border-radius:4px;box-shadow:0 0 0 transparent}.pll-selectmenu-button.ui-widget,.pll-selectmenu-menu .ui-widget{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px}.languages_page_mlang .ui-button.ui-selectmenu-button:focus{background:#fff;border-color:#007cba;box-shadow:0 0 0 1px #007cba;color:#016087;outline:2px solid transparent}.languages_page_mlang .ui-menu-item,.languages_page_mlang .ui-widget-content .ui-state-active,.languages_page_mlang .ui-widget-content .ui-state-focus,.languages_page_mlang .ui-widget-content .ui-state-hover{color:#016087;margin:0}.pll-selectmenu-menu .ui-widget-content .ui-state-active,.pll-selectmenu-menu .ui-widget-content .ui-state-focus,.pll-selectmenu-menu .ui-widget-content .ui-state-hover,.ui-selectmenu-open .ui-widget-content .ui-state-active,.ui-selectmenu-open .ui-widget-content .ui-state-focus,.ui-selectmenu-open .ui-widget-content .ui-state-hover{background:#d5d5d5;border:0}.ui-selectmenu-button.ui-state-focus{border:1px solid #5b9dd9;box-shadow:0 0 2px rgba(30,140,190,.8)}.ui-icon-triangle-1-s:before{background:#fff url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E") no-repeat right 0 top 55%;background-size:16px 16px;box-sizing:border-box;content:"";height:16px;position:absolute;width:16px}.pll-selectmenu-button.ui-button:hover,.pll-wizard .ui-button:focus,.pll-wizard .ui-button:hover{background:#fff}.ui-widget-content{box-shadow:0 2px 6px hsla(0,0%,39%,.3);max-height:231px}
@@ -0,0 +1 @@
.flag{width:16px;height:11px;display:inline-block}.components-modal__frame.confirmBox{height:auto}.components-modal__frame.confirmBox .buttons{display:block;text-align:right}.components-modal__frame.confirmBox .buttons button:first-child{margin-right:1rem}.translations p{margin-top:1em}.translations td span{box-sizing:border-box}.translations .pll-column-icon:not(.pll-delete-column)>a{color:var(--wp-admin-theme-color);width:20px;padding:2px 0 0}.translations .pll-column-icon>button{padding:0}.translations .pll-column-icon.pll-delete-column>.pll-button:not(:disabled){color:#cc1818}.translations .pll-feature-button-row-container{width:calc(26px*var(--pll-icon-count, 1))}.translations .pll-feature-button-row-container:has(.pll-column-icon){--pll-icon-count: 1}.translations .pll-feature-button-row-container:has(.pll-column-icon+.pll-column-icon){--pll-icon-count: 2}.translations .pll-feature-button-row-container:has(.pll-column-icon+.pll-column-icon+.pll-column-icon){--pll-icon-count: 3}body:not(.rtl) .translations .pll-translation-language{margin-left:10px}.rtl .translations .pll-translation-language{margin-right:10px}:not(.pll-delete-column)>.components-button.pll-button,:not(.pll-delete-column)>.components-button.pll-button:focus:enabled:not(.wp-ui-text-highlight),:not(.pll-delete-column)>.components-button.pll-button,:not(.pll-delete-column)>.components-button.pll-button:focus:enabled:not(.wp-ui-text-highlight){color:#ccc}:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight:focus:enabled,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight:focus:enabled{color:var(--wp-admin-theme-color)}.pll-delete-column>.components-button.pll-button:disabled:hover{color:#1e1e1e}.rtl .pll-before-post-translations-button{float:left}.pll-button{height:auto}.pll-button.has-icon.has-text svg{margin:0}.pll-metabox-location .components-button.has-icon{min-width:auto}.pll-metabox-error.components-notice{margin:0}.components-panel #post-translations .pll-language-column{width:21px;padding-right:4px}.components-panel #post-translations .pll-column-icon{width:26px;padding:1px;text-align:center}.pll-translations-table-header{display:flex;flex-direction:row;gap:1rem}.pll-translations-table-header-title{flex:1}.pll-plugin-feature-button-container{margin-left:auto;display:flex}.pll-translation-column{position:relative}.pll-translation-column ul{position:absolute;top:41px;left:0;z-index:10;width:100%}.pll-translation-column li.is-empty,.pll-translation-column li[aria-selected=false]{background-color:var(--wp--preset--color--white);border:1px solid #949494}#pll-language-select-control{display:flex;align-items:center;gap:10px}#pll-language-select-control .pll-translation-icon{width:16px;display:inline-block;vertical-align:middle}.pll-language-item{margin:10px auto 5px auto}.pll-language-item .pll-select-flag{margin-right:10px;margin-left:3px;padding:2px;display:inline-block}.pll-language-item .pll-language-name{font-size:1.1em}.pll-metabox-info{font-style:italic;color:#757575;font-size:.9em}.pll-default-lang-icon{width:15px;height:15px}.pll-default-lang-icon path{fill:var(--wp-admin-theme-color)}.pll-language-item .pll-default-lang-icon{vertical-align:text-top}body:not(.rtl) .pll-language-item .pll-default-lang-icon{margin-left:5px}.rtl .pll-language-item .pll-default-lang-icon{margin-right:5px}.pll-default-lang-column .pll-default-lang-icon{margin-top:2px}
@@ -0,0 +1 @@
.flag{width:16px;height:11px;display:inline-block}.components-modal__frame.confirmBox{height:auto}.components-modal__frame.confirmBox .buttons{display:block;text-align:right}.components-modal__frame.confirmBox .buttons button:first-child{margin-right:1rem}.translations p{margin-top:1em}.translations td span{box-sizing:border-box}.translations .pll-column-icon:not(.pll-delete-column)>a{color:var(--wp-admin-theme-color);width:20px;padding:2px 0 0}.translations .pll-column-icon>button{padding:0}.translations .pll-column-icon.pll-delete-column>.pll-button:not(:disabled){color:#cc1818}.translations .pll-feature-button-row-container{width:calc(26px*var(--pll-icon-count, 1))}.translations .pll-feature-button-row-container:has(.pll-column-icon){--pll-icon-count: 1}.translations .pll-feature-button-row-container:has(.pll-column-icon+.pll-column-icon){--pll-icon-count: 2}.translations .pll-feature-button-row-container:has(.pll-column-icon+.pll-column-icon+.pll-column-icon){--pll-icon-count: 3}body:not(.rtl) .translations .pll-translation-language{margin-left:10px}.rtl .translations .pll-translation-language{margin-right:10px}:not(.pll-delete-column)>.components-button.pll-button,:not(.pll-delete-column)>.components-button.pll-button:focus:enabled:not(.wp-ui-text-highlight),:not(.pll-delete-column)>.components-button.pll-button,:not(.pll-delete-column)>.components-button.pll-button:focus:enabled:not(.wp-ui-text-highlight){color:#ccc}:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight:focus:enabled,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight,:not(.pll-delete-column)>.components-button.pll-button.wp-ui-text-highlight:focus:enabled{color:var(--wp-admin-theme-color)}.pll-delete-column>.components-button.pll-button:disabled:hover{color:#1e1e1e}.rtl .pll-before-post-translations-button{float:left}.pll-button{height:auto}.pll-button.has-icon.has-text svg{margin:0}.pll-metabox-location .components-button.has-icon{min-width:auto}.pll-metabox-error.components-notice{margin:0}.components-panel #post-translations .pll-language-column{width:21px;padding-right:4px}.components-panel #post-translations .pll-column-icon{width:26px;padding:1px;text-align:center}.pll-translations-table-header{display:flex;flex-direction:row;gap:1rem}.pll-translations-table-header-title{flex:1}.pll-plugin-feature-button-container{margin-left:auto;display:flex}.pll-translation-column{position:relative}.pll-translation-column ul{position:absolute;top:41px;left:0;z-index:10;width:100%}.pll-translation-column li.is-empty,.pll-translation-column li[aria-selected=false]{background-color:var(--wp--preset--color--white);border:1px solid #949494}#pll-language-select-control{display:flex;align-items:center;gap:10px}#pll-language-select-control .pll-translation-icon{width:16px;display:inline-block;vertical-align:middle}.pll-language-item{margin:10px auto 5px auto}.pll-language-item .pll-select-flag{margin-right:10px;margin-left:3px;padding:2px;display:inline-block}.pll-language-item .pll-language-name{font-size:1.1em}.pll-metabox-info{font-style:italic;color:#757575;font-size:.9em}.pll-default-lang-icon{width:15px;height:15px}.pll-default-lang-icon path{fill:var(--wp-admin-theme-color)}.pll-language-item .pll-default-lang-icon{vertical-align:text-top}body:not(.rtl) .pll-language-item .pll-default-lang-icon{margin-left:5px}.rtl .pll-language-item .pll-default-lang-icon{margin-right:5px}.pll-default-lang-column .pll-default-lang-icon{margin-top:2px}
@@ -0,0 +1,63 @@
/* Metaboxes holder in Strings translations screen */
.languages_page_mlang_strings .metabox-holder > div {
display: flex;
flex-wrap: wrap;
}
.languages_page_mlang_strings .metabox-holder > div > div {
display: flex;
flex-direction: column;
flex-basis: 0;
flex-grow: 1;
}
.languages_page_mlang_strings .metabox-holder > div > div:not(:first-child) {
margin-left: 1rem;
}
.languages_page_mlang_strings .metabox-holder > div > div.closed {
border:0;
background: none;
}
.languages_page_mlang_strings .metabox-holder > div > div.closed .postbox-header{
border: 1px solid #ccd0d4;
background: #fff;
}
#pll-export-strings-box.postbox .submit, /* Override WordPress styles */
#pll-import-translations-box.postbox .submit,
#pll-machine-strings-translations.postbox .submit {
float: none;
padding: 0;
}
.postbox .inside {
margin: 0;
}
#pll-machine-strings-translations .pll-translation-flag, #export-string-translation .pll-translation-flag {
margin: auto 10px auto 7px;
}
#export-string-translation label,
#export-string-translation label[for="pll-select-format"] span,
#import-translation label,
#pll-machine-strings-translations label {
display: block;
margin: 0.35em 0 0.5em;
}
.pll-legend {
display: block;
padding: 2px 0;
color: #1d2327;
font-weight: 400;
text-shadow: none;
margin: 0.35em 0 0.5em;
}
/* Narrow devices */
@media screen and ( max-width: 1024px ) {
.languages_page_mlang_strings .metabox-holder > div {
flex-direction: column;
}
.languages_page_mlang_strings .metabox-holder > div > div:not(:first-child) {
margin-left: 0;
}
}
@@ -0,0 +1 @@
.languages_page_mlang_strings .metabox-holder>div{display:flex;flex-wrap:wrap}.languages_page_mlang_strings .metabox-holder>div>div{display:flex;flex-basis:0;flex-direction:column;flex-grow:1}.languages_page_mlang_strings .metabox-holder>div>div:not(:first-child){margin-left:1rem}.languages_page_mlang_strings .metabox-holder>div>div.closed{background:none;border:0}.languages_page_mlang_strings .metabox-holder>div>div.closed .postbox-header{background:#fff;border:1px solid #ccd0d4}#pll-export-strings-box.postbox .submit,#pll-import-translations-box.postbox .submit,#pll-machine-strings-translations.postbox .submit{float:none;padding:0}.postbox .inside{margin:0}#export-string-translation .pll-translation-flag,#pll-machine-strings-translations .pll-translation-flag{margin:auto 10px auto 7px}#export-string-translation label,#export-string-translation label[for=pll-select-format] span,#import-translation label,#pll-machine-strings-translations label,.pll-legend{display:block;margin:.35em 0 .5em}.pll-legend{color:#1d2327;font-weight:400;padding:2px 0;text-shadow:none}@media screen and (max-width:1024px){.languages_page_mlang_strings .metabox-holder>div{flex-direction:column}.languages_page_mlang_strings .metabox-holder>div>div:not(:first-child){margin-left:0}}
@@ -0,0 +1,952 @@
@charset "UTF-8";
body {
margin: 65px auto 24px;
box-shadow: none;
background: #f1f1f1;
padding: 0;
border: 0; /* fix-pro #856 override WP install.css */
}
#pll-logo {
border: 0;
margin: 0 0 24px;
padding: 0;
text-align: center;
font-family: sans-serif;
font-size: 64px;
text-transform: uppercase;
color: #000;
line-height: normal;
}
#pll-logo a {
display: flex;
justify-content: center;
color: #000;
text-decoration: none;
}
#pll-logo img {
max-width: 100%;
margin-right: 16px;
}
.rtl #pll-logo img {
margin-right: 0;
margin-left: 16px;
}
.pll-wizard-footer {
text-align: center
}
.pll-wizard .select2-container {
text-align: left;
width: auto
}
.pll-wizard .hidden {
display: none
}
.pll-wizard-content {
box-shadow: 0 1px 3px rgba(0, 0, 0, .13);
padding: 2em;
margin: 0 0 20px;
background: #fff;
overflow: hidden;
zoom: 1;
text-align: left;
}
.rtl .pll-wizard-content{
text-align: right;
}
.pll-wizard-content h1,
.pll-wizard-content h2,
.pll-wizard-content h3,
.pll-wizard-content table {
margin: 0 0 20px;
border: 0;
padding: 0;
color: #666;
clear: none;
font-weight: 500
}
.pll-wizard-content p {
margin: 20px 0;
font-size: 1em;
line-height: 1.75em;
color: #666
}
.pll-wizard-content table {
font-size: 1em;
line-height: 1.75em;
color: #666;
width: 100%;
margin-top: 20px;
}
.pll-wizard-content table td span{
display: inline-block;
}
.pll-wizard-content table caption {
caption-side: bottom;
font-style: italic;
text-align: right;
}
.rtl .pll-wizard-content table caption {
text-align: left;
}
.pll-wizard-content table caption .icon-default-lang{
font-style: normal;
}
.pll-wizard-content a {
color: #a03f3f;
}
.pll-wizard-content a:focus,
.pll-wizard-content a:hover,
.pll-wizard-footer-links:hover {
color: #dd5454
}
.pll-wizard-content .pll-wizard-next-steps {
overflow: hidden;
margin: 0 0 24px;
padding-bottom: 2px
}
.pll-wizard-content .pll-wizard-next-steps h2 {
margin-bottom: 12px
}
.pll-wizard-content .pll-wizard-next-steps .pll-wizard-next-steps-first {
float: left;
width: 50%;
box-sizing: border-box
}
.pll-wizard-content .pll-wizard-next-steps .pll-wizard-next-steps-last {
float: right;
width: 50%;
box-sizing: border-box
}
.pll-wizard-content .pll-wizard-next-steps ul {
padding: 0 2em 0 0;
list-style: none outside;
margin: 0
}
.pll-wizard-content .pll-wizard-next-steps ul li a {
display: block;
padding: 0 0 .75em
}
.pll-wizard-content .pll-wizard-next-steps ul li a::before {
color: #82878c;
font: normal 20px/1 dashicons;
speak: none;
display: inline-block;
padding: 0 10px 0 0;
top: 1px;
position: relative;
text-decoration: none!important;
vertical-align: top
}
.pll-wizard-steps {
padding: 0 0 24px;
margin: 0;
list-style: none outside;
overflow: hidden;
color: #ccc;
width: 100%;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: inline-flex
}
.pll-wizard-steps li {
width: 100%;
float: left;
padding: 0 0 .8em;
margin: 0;
text-align: center;
position: relative;
border-bottom: 4px solid #ccc;
line-height: 1.4em
}
.pll-wizard-steps li a {
color: #a03f3f;
text-decoration: none;
padding: 1.5em;
margin: -1.5em;
position: relative;
z-index: 1
}
.pll-wizard-steps li a:focus,
.pll-wizard-steps li a:hover {
color: #dd5454;
text-decoration: underline
}
.pll-wizard-steps li::before {
content: "";
border: 4px solid #ccc;
border-radius: 100%;
width: 4px;
height: 4px;
position: absolute;
bottom: 0;
left: 50%;
margin-left: -6px;
margin-bottom: -8px;
background: #fff
}
.pll-wizard-steps li.active {
border-color: #a03f3f;
color: #a03f3f;
font-weight: 700
}
.pll-wizard-steps li.active::before {
border-color: #a03f3f
}
.pll-wizard-steps li.done {
border-color: #a03f3f;
color: #a03f3f
}
.pll-wizard-steps li.done::before {
border-color: #a03f3f;
background: #a03f3f
}
.pll-wizard .pll-wizard-actions {
overflow: hidden;
margin: 20px 0 0;
position: relative
}
.pll-wizard .pll-wizard-actions .button {
font-size: 16px;
font-weight: 300;
padding: 1em 2em;
line-height: 1em;
margin-right: .5em;
margin-bottom: 2px;
margin-top: 10px;
height: auto;
border-radius: 4px;
box-shadow: none;
min-width: auto;
border-color: #a03f3f;
color: #a03f3f;
}
.pll-wizard .pll-wizard-content .button {
border-color: #a03f3f;
color: #a03f3f;
}
.pll-wizard .pll-wizard-content .button-primary,
.pll-wizard .pll-wizard-actions .button-primary {
background-color: #a03f3f;
border-color: #a03f3f;
color: #fff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #a03f3f;
text-shadow: 0 -1px 1px #a03f3f, 1px 0 1px #a03f3f, 0 1px 1px #a03f3f, -1px 0 1px #a03f3f;
margin: 0;
opacity: 1
}
.pll-wizard .pll-wizard-content .button-small .dashicons {
font-size: 15px;
height: auto;
vertical-align: middle;
}
.pll-wizard .button-primary:active,
.pll-wizard .button-primary:focus,
.pll-wizard input[type="checkbox"]:focus + label.button-primary,
.pll-wizard .button-primary:hover {
background: #dd5454;
border-color: #dd5454;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #dd5454
}
.pll-wizard .pll-wizard-actions .button-primary[disabled],
.pll-wizard .pll-wizard-actions .button-primary:disabled,
.pll-wizard .pll-wizard-actions .button-primary.disabled {
cursor: wait;
background-color: #bb5454 !important;
border-color: #bb5454 !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #bb5454 !important;
text-shadow: 0 -1px 1px #bb5454, 1px 0 1px #bb5454, 0 1px 1px #bb5454, -1px 0 1px #bb5454 !important;
color: #ffa3a3 !important;
}
.pll-wizard-content p:last-child {
margin-bottom: 0
}
.pll-wizard-footer-links {
font-size: .85em;
color: #7b7b7b;
margin: 1.18em auto;
display: inline-block;
text-align: center
}
.pll-wizard-services {
border: 1px solid #eee;
padding: 0;
margin: 0 0 1em;
list-style: none outside;
border-radius: 4px;
overflow: hidden
}
.pll-wizard-services p {
margin: 0 0 1em 0;
padding: 0;
font-size: 1em;
line-height: 1.5em
}
.pll-wizard-service-item {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
padding: 0;
border-bottom: 1px solid #eee;
color: #666;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center
}
.media-step .pll-wizard-service-item{
border: 0;
}
.media-step .pll-wizard-service-item:last-child{
display: block;
}
.media-step .pll-wizard-service-item .pll-wizard-service-enable{
padding-bottom: 0;
}
.pll-wizard-service-item:last-child {
border-bottom: 0
}
.pll-wizard-service-item .pll-wizard-service-name {
-webkit-flex-basis: 0;
flex-basis: 0;
min-width: 160px;
text-align: center;
font-weight: 700;
padding: 2em 0;
-webkit-align-self: stretch;
align-self: stretch;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: baseline;
-webkit-align-items: baseline;
align-items: baseline
}
.pll-wizard-service-item .pll-wizard-service-name img {
max-width: 75px
}
.pll-wizard-service-item .pll-wizard-service-description {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
flex-grow: 1;
padding: 20px
}
.pll-wizard-service-item .pll-wizard-service-example {
padding: 0 20px 20px
}
.pll-wizard-service-item .pll-wizard-service-example p{
text-align: right;
}
.rtl .pll-wizard-service-item .pll-wizard-service-example p{
text-align: left;
}
.pll-wizard-service-item .pll-wizard-service-description p {
margin-bottom: 1em
}
.pll-wizard-service-item .pll-wizard-service-description p:last-child {
margin-bottom: 0
}
.pll-wizard-service-item .pll-wizard-service-description .pll-wizard-service-settings-description {
display: block;
font-style: italic;
color: #999
}
.pll-wizard-service-item .pll-wizard-service-enable {
-webkit-flex-basis: 0;
flex-basis: 0;
min-width: 75px;
text-align: center;
cursor: pointer;
padding: 2em 0;
position: relative;
max-height: 1.5em;
-webkit-align-self: flex-start;
align-self: flex-start;
-webkit-box-ordinal-group: 4;
-webkit-order: 3;
order: 3
}
.pll-wizard-service-item .pll-wizard-service-toggle {
position: relative
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] {
position:absolute;
opacity: 0;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] + label {
position: relative;
display: inline-block;
width: 44px;
height: 20px;
border-radius: 10em;
cursor: pointer;
text-indent: -9999px;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox]:focus + label {
border:1px dashed #777;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] + label::before,
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] + label::after {
content: '';
position: absolute;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] + label::before {
left: 0;
top: 0;
width: 44px;
height: 20px;
background: #ddd;
border-radius: 10em;
transition: background-color .2s;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox] + label::after {
width: 16px;
height: 16px;
transition: all .2s;
border-radius: 50%;
background: #fff;
margin: 2px;
top: 0;
left: 0;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox]:checked + label::before {
background:#a03f3f;
}
.pll-wizard-service-item .pll-wizard-service-toggle input[type=checkbox]:checked + label::after {
right: 0;
left:auto;
}
.pll-wizard-service-item .pll-wizard-service-settings {
display: none;
margin-top: .75em;
margin-bottom: 0;
cursor: default
}
.pll-wizard-service-item .pll-wizard-service-settings.hide {
display: none
}
.pll-wizard-service-item.checked .pll-wizard-service-settings {
display: inline-block
}
.pll-wizard-service-item.checked .pll-wizard-service-settings.hide {
display: none
}
.pll-wizard-service-item.closed {
border-bottom: 0
}
.step {
text-align: center
}
.pll-wizard .button .dashicons{
vertical-align: middle;
line-height: 1;
}
.rtl .dashicons-arrow-right-alt2:before {
content: "\f341";
}
.pll-wizard .pll-wizard-actions .button:active,
.pll-wizard .pll-wizard-actions .button:focus,
.pll-wizard .pll-wizard-actions .button:hover {
box-shadow: none
}
.pll-wizard-next-steps {
border: 1px solid #eee;
border-radius: 4px;
list-style: none;
padding: 0
}
.pll-wizard-next-steps li {
padding: 0
}
.pll-wizard-next-steps .pll-wizard-next-step-item {
display: -webkit-box;
display: -webkit-flex;
display: flex;
border-top: 1px solid #eee
}
.pll-wizard-next-steps .pll-wizard-next-step-item.no-border,
.pll-wizard-next-steps .pll-wizard-next-step-item:first-child {
border-top: 0
}
.pll-wizard-next-steps .pll-wizard-next-step-description {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
flex-grow: 1;
margin: 1.5em
}
.pll-wizard-next-steps .pll-wizard-next-step-action {
-webkit-box-flex: 0;
-webkit-flex-grow: 0;
flex-grow: 0;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center
}
.pll-wizard-next-steps .pll-wizard-next-step-action .button {
margin: 1em 1.5em
}
.pll-wizard-next-steps .pll-wizard-next-step-item.no-border .pll-wizard-next-step-description,
.pll-wizard-next-steps .pll-wizard-next-step-item.no-border .pll-wizard-actions,
.pll-wizard-next-steps .pll-wizard-next-step-item.no-border .pll-wizard-next-step-action .button{
margin-top: 0;
}
.pll-wizard-next-steps p.next-step-heading {
margin: 0;
font-size: .95em;
font-weight: 400;
font-variant: all-petite-caps
}
.pll-wizard-next-steps p.next-step-extra-info {
margin: 0
}
.pll-wizard-next-steps h3.next-step-description {
margin: 0;
font-size: 16px;
font-weight: 600;
}
.pll-wizard-next-steps .pll-wizard-additional-steps {
border-top: 1px solid #eee;
}
.pll-wizard-next-steps .pll-wizard-additional-steps .pll-wizard-next-step-description {
margin-bottom: 0
}
.pll-wizard-next-steps .pll-wizard-additional-steps .pll-wizard-actions {
margin: 0 0 1.5em 0;
}
.pll-wizard-next-steps .pll-wizard-additional-steps .pll-wizard-actions .button {
font-size: 15px;
margin: 1em 0 1em 1.5em;
}
.rtl .pll-wizard-next-steps .pll-wizard-additional-steps .pll-wizard-actions .button {
margin: 1em 1.5em 1em 0;
}
.pll-wizard-next-steps .pll-wizard-additional-steps .pll-wizard-actions .button::last-child {
margin-right: 1.5em;
}
.pll-wizard-content img{
max-width: 100%;
margin-right: 0.5em;
}
.rtl .pll-wizard-content img{
margin-left: 0.5em;
}
.pll-wizard-content .form-field label{
margin-bottom: 5px;
display: block;
}
.pll-wizard-content .form-field select{
padding: 3px;
}
.pll-wizard-content .languages-step select,
.pll-wizard-content .untranslated-contents-step select{
width: 100%;
}
.languages-step .form-field .button{
margin-left: 15px;
}
.languages-step .form-field .button > span{
margin-right: 0.3em;
}
.rtl .languages-step .form-field .button{
margin-left: 0;
margin-right: 15px;
}
.rtl .languages-step .form-field .button > span{
margin-left: 0.3em;
margin-right: 0;
}
.pll-wizard-content .languages-step .select-language-field{
display: flex;
}
.pll-wizard-content #languages{
display: none;
}
.pll-wizard-content #languages tr th:first-child{
width: 80%;
}
.pll-wizard-content #languages .dashicons{
color: #a03f3f;
}
.pll-wizard-content #languages img{
margin-right: 5px;
}
.pll-wizard-content .error{
color: #a03f3f;
font-weight: bold;
}
.pll-wizard-content #messages .error{
background: #fccfcf;
padding: 0.5rem;
border: 1px solid #a03f3f;
margin-bottom: 0.5rem;
}
.pll-wizard-content #slide-toggle{
position:absolute;
opacity: 0;
}
.pll-wizard-content #slide-toggle + label{
position:relative;
}
.pll-wizard-content #slide-toggle + label + span{
display: block;
}
.pll-wizard-content #slide-toggle + label .dashicons{
margin-right: 0.3em;
}
.rtl .pll-wizard-content #slide-toggle + label .dashicons{
margin-left: 0.3em;
margin-right: 0;
}
.pll-wizard-content #slide-toggle ~ #screenshot > img {
max-height: 500px;
margin-top: 10px;
-webkit-transition: all .5s cubic-bezier(0, 1, 0.5, 1);
transition: all .5s cubic-bezier(0, 1, 0.5, 1);
}
.pll-wizard-content #slide-toggle:checked ~ #screenshot > img {
max-height: 0;
}
.hide {
display: none;
}
input[type="text"].field-in-error,
input[type="password"].field-in-error,
input[type="checkbox"].field-in-error,
input[type="color"].field-in-error,
input[type="date"].field-in-error,
input[type="datetime"].field-in-error,
input[type="datetime-local"].field-in-error,
input[type="email"].field-in-error,
input[type="month"].field-in-error,
input[type="number"].field-in-error,
input[type="search"].field-in-error,
input[type="radio"].field-in-error,
input[type="tel"].field-in-error,
input[type="text"].field-in-error,
input[type="time"].field-in-error,
input[type="url"].field-in-error,
input[type="week"].field-in-error,
select.field-in-error,
textarea.field-in-error,
span.field-in-error,
.field-in-error{
border-color: #a03f3f;
}
input[type="text"].field-in-error:focus,
input[type="password"].field-in-error:focus,
input[type="checkbox"].field-in-error:focus,
input[type="color"].field-in-error:focus,
input[type="date"].field-in-error:focus,
input[type="datetime"].field-in-error:focus,
input[type="datetime-local"].field-in-error:focus,
input[type="email"].field-in-error:focus,
input[type="month"].field-in-error:focus,
input[type="number"].field-in-error:focus,
input[type="search"].field-in-error:focus,
input[type="radio"].field-in-error:focus,
input[type="tel"].field-in-error:focus,
input[type="text"].field-in-error:focus,
input[type="time"].field-in-error:focus,
input[type="url"].field-in-error:focus,
input[type="week"].field-in-error:focus,
select.field-in-error:focus,
textarea.field-in-error:focus,
span.field-in-error:focus,
.field-in-error:focus{
border: 1px solid #a03f3f;
box-shadow: 0 0 2px rgba(160, 63, 63, 0.8);
outline-color: #a03f3f;
outline-style: auto;
outline-width: thin;
}
/* override install styles by returning back to forms styles */
.form-table input.regular-text{
width: 25em;
}
.form-table input.field-in-error{
border-color: #a03f3f;
}
#pll-licenses-table td{
padding: 10px 9px;
}
#pll-licenses-table .license-valid td p{
min-width: 35em;
}
#pll-licenses-table .pll-deactivate-license{
margin: 0 0 0 20px;
}
.rtl #pll-licenses-table .pll-deactivate-license{
margin: 0 10px 0 0;
}
.pll-wizard-content .documentation {
padding: 24px 24px 0;
margin: 0 0 24px;
overflow: hidden;
background: #f5f5f5
}
.pll-wizard-content .documentation p {
padding: 0;
margin: 0 0 12px;
}
.documentation-container {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: flex-end;
}
.documentation-container .documentation-button-container {
-webkit-box-flex: 0;
-webkit-flex-grow: 0;
flex-grow: 0;
}
.wc-setup .wc-setup-actions .button.documentation-button {
height: 42px;
padding: 0 1em;
margin: 0;
}
#dialog{
display: none;
}
.pll-wizard .ui-dialog.ui-widget-content{
max-height: none;
}
.pll-wizard .ui-dialog-title::before{
content: "\f534";
font-family: dashicons;
display: inline-block;
line-height: 1;
font-weight: 400;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
width: 20px;
height: 20px;
font-size: 20px;
vertical-align: middle;
text-align: center;
margin: 0 5px 5px 0;
transition: color 0.1s ease-in;
}
.rtl.pll-wizard .ui-dialog-title::before{
margin-right: 0;
margin-left: 5px;
}
.pll-wizard .ui-dialog ul{
list-style: disc;
padding-left: 20px;
}
.rtl.pll-wizard .ui-dialog ul{
padding-left: 0;
padding-right: 20px;
}
.pll-wizard li{
margin-bottom: 0;
}
#translations{
border-collapse: collapse;
}
#translations tbody:nth-child(odd){
background-color: #f9f9f9;
}
#translations.striped > tbody > :nth-child(odd) {
background-color: transparent; /* Override common WordPress style */
}
.pll-wizard-content mark{
background: transparent none;
}
.pll-wizard-content mark{
color: #7ad03a;
}
@media screen and (max-width: 782px) {
/* Override WordPress button css rules */
.languages-step .form-field .button{
font-size: 13px;
line-height: 26px;
height: 28px;
padding: 0 10px 1px;
vertical-align: top;
}
#pll-licenses-table .pll-deactivate-license{
margin: 10px 0 5px;
}
}
@media only screen and (max-width:620px) {
/* Override dialog width rule */
.ui-dialog{
width: 100% !important;
}
}
@media only screen and (max-width:500px) {
#pll-logo a,
.select-language-field{
flex-direction: column;
}
.select-language-field .action-buttons{
display: flex;
justify-content: flex-end;
}
.languages-step .form-field .button{
margin: 5px 0 0;
}
}
@media only screen and (max-width:400px) {
#pll-logo {
font-size: 56px;
}
.pll-wizard-steps {
display: none
}
.pll-wizard-service-item {
-webkit-flex-wrap: wrap;
flex-wrap: wrap
}
.pll-wizard-service-item .pll-wizard-service-enable {
-webkit-box-ordinal-group: 3;
-webkit-order: 2;
order: 2;
padding: 20px 0 0
}
.pll-wizard-service-item .pll-wizard-service-description {
-webkit-box-ordinal-group: 4;
-webkit-order: 3;
order: 3
}
.pll-wizard-service-item .pll-wizard-service-name {
padding: 20px 20px 0;
text-align: left;
-webkit-box-pack: justify!important;
-webkit-justify-content: space-between!important;
justify-content: space-between!important
}
.pll-wizard-service-item .pll-wizard-service-name img {
margin: 0
}
.pll-wizard-next-steps .pll-wizard-next-step-item {
-webkit-flex-wrap: wrap;
flex-wrap: wrap
}
.pll-wizard-next-steps .pll-wizard-next-step-item .pll-wizard-next-step-description {
margin-bottom: 0
}
.pll-wizard-next-steps .pll-wizard-next-step-item .pll-wizard-next-step-action p {
margin: 0
}
}
@media only screen and (max-width:360px) {
#pll-logo {
font-size: 48px;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
/* Settings */
#pllu-licenses-table label {
font-size: 1em;
font-weight: 600;
}
/* Wizard */
#pllu-licenses-table td {
padding: 10px 9px;
}
#pllu-licenses-table .license-valid td p {
min-width: 35em;
}
#pllu-licenses-table .pllu-deactivate-license {
margin: 0 0 0 20px;
}
.rtl #pllu-licenses-table .pllu-deactivate-license {
margin: 0 10px 0 0;
}
@media screen and (max-width: 782px) {
/* Settings */
#wpbody-content .pll-settings #pllu-licenses-table td {
display: block;
}
/* Wizard */
#pllu-licenses-table .pllu-deactivate-license {
margin: 10px 0 5px;
}
}
@@ -0,0 +1 @@
#pllu-licenses-table label{font-size:1em;font-weight:600}#pllu-licenses-table td{padding:10px 9px}#pllu-licenses-table .license-valid td p{min-width:35em}#pllu-licenses-table .pllu-deactivate-license{margin:0 0 0 20px}.rtl #pllu-licenses-table .pllu-deactivate-license{margin:0 10px 0 0}@media screen and (max-width:782px){#wpbody-content .pll-settings #pllu-licenses-table td{display:block}#pllu-licenses-table .pllu-deactivate-license{margin:10px 0 5px}}
@@ -0,0 +1,89 @@
const pllSettingsLicenses = {
/**
* Init.
*/
init: () => {
if (document.readyState !== 'loading') {
pllSettingsLicenses.ready();
} else {
document.addEventListener('DOMContentLoaded', pllSettingsLicenses.ready);
}
},
ready: () => {
wp.hooks.addAction('pll_settings_saved', 'polylang-updater', pllSettingsLicenses.manageLicenses.onUpdate);
pllSettingsLicenses.manageLicenses.display();
},
manageLicenses: {
display: () => {
const table = document.getElementById('pllu-licenses-table');
if (!table) {
return;
}
const action = table.getAttribute('data-action');
const nonce = table.getAttribute('data-nonce');
if (!action || !nonce) {
return;
}
const urlParams = {
action,
_pll_nonce: nonce,
pll_ajax_settings: 1
};
const url = wp.url.addQueryArgs(ajaxurl, urlParams);
fetch(url).then(response => {
return response.json();
}).then(json => {
if (!json.success) {
return;
}
json.data.row.forEach(item => {
table.insertAdjacentHTML('beforeend', item);
});
pllSettingsLicenses.manageLicenses.attachDeactivationEvent();
});
},
attachDeactivationEvent: () => {
let table = document.querySelector('#pllu-licenses-table');
if (!table) {
return;
}
table.addEventListener('click', el => {
if (!el.target.classList.contains('pllu-deactivate-license')) {
return;
}
const data = new FormData();
data.set('action', 'pllu_deactivate_license');
data.set('pll_ajax_settings', 1);
data.set('id', el.target.id);
data.set('_pll_nonce', document.querySelector('#_pll_nonce').value);
// POST request using fetch().
fetch(ajaxurl, {
method: "POST",
body: data
}).then(response => {
return response.json();
}).then(json => {
if (!json.success) {
return;
}
// Data comes from `License::get_form_field()`, where everything is escaped.
const license = document.querySelector('#pllu-license-' + json.data.id);
if (license) {
license.outerHTML = json.data.html;
}
});
});
},
onUpdate: response => {
if ('pllu-license-update' === response.what) {
const license = document.querySelector(`#pllu-license-${response.data}`);
if (license) {
license.outerHTML = response.supplemental.html;
}
}
}
}
};
pllSettingsLicenses.init();
@@ -0,0 +1 @@
const pllSettingsLicenses={init:()=>{"loading"!==document.readyState?pllSettingsLicenses.ready():document.addEventListener("DOMContentLoaded",pllSettingsLicenses.ready)},ready:()=>{wp.hooks.addAction("pll_settings_saved","polylang-updater",pllSettingsLicenses.manageLicenses.onUpdate),pllSettingsLicenses.manageLicenses.display()},manageLicenses:{display:()=>{const e=document.getElementById("pllu-licenses-table");if(!e)return;const t=e.getAttribute("data-action"),n=e.getAttribute("data-nonce");if(!t||!n)return;const s={action:t,_pll_nonce:n,pll_ajax_settings:1},a=wp.url.addQueryArgs(ajaxurl,s);fetch(a).then((e=>e.json())).then((t=>{t.success&&(t.data.row.forEach((t=>{e.insertAdjacentHTML("beforeend",t)})),pllSettingsLicenses.manageLicenses.attachDeactivationEvent())}))},attachDeactivationEvent:()=>{let e=document.querySelector("#pllu-licenses-table");e&&e.addEventListener("click",(e=>{if(!e.target.classList.contains("pllu-deactivate-license"))return;const t=new FormData;t.set("action","pllu_deactivate_license"),t.set("pll_ajax_settings",1),t.set("id",e.target.id),t.set("_pll_nonce",document.querySelector("#_pll_nonce").value),fetch(ajaxurl,{method:"POST",body:t}).then((e=>e.json())).then((e=>{if(!e.success)return;const t=document.querySelector("#pllu-license-"+e.data.id);t&&(t.outerHTML=e.data.html)}))}))},onUpdate:e=>{if("pllu-license-update"===e.what){const t=document.querySelector(`#pllu-license-${e.data}`);t&&(t.outerHTML=e.supplemental.html)}}}};pllSettingsLicenses.init();
@@ -0,0 +1,123 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use PLL_License;
defined( 'ABSPATH' ) || exit;
/**
* Trait that holds common code between `Settings` and `Wizard_Licenses_Step`.
*
* @since 1.0
*/
trait Common_Trait {
/**
* Stores an array of objects allowing to manage a license.
* In case of one plugin is using this new system, and another is using the old one, we must allow both classes.
*
* @var (License|PLL_License)[]|null
*/
private $items;
/**
* Returns a list of license objects.
*
* @since 1.0
*
* @return (License|PLL_License)[] Array of instances of `WP_Syntex\Polylang_Pro\Updater\License` or `PLL_License`,
* keyed by string IDs.
*/
private function get_licenses(): array {
if ( is_array( $this->items ) ) {
return $this->items;
}
/**
* Filters the list of Polylang licenses.
*
* @since 1.0
*
* @param (License|PLL_License)[] $licenses Array of instances of `WP_Syntex\Polylang_Pro\Updater\License`
* or `PLL_License`, keyed by string IDs.
*/
$this->items = (array) apply_filters( 'pll_settings_licenses', array() );
return $this->items;
}
/**
* Launches hooks.
*
* @since 1.0
*
* @return void
*/
private function hooks(): void {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'wp_ajax_pllu_deactivate_license', array( $this, 'deactivate_license' ) );
}
/**
* Enqueues styles and scripts.
*
* @since 1.0
*
* @return void
*/
public function enqueue_scripts(): void {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
/*
* Use `__DIR__` in `plugins_url()` to get the path to a "file" located at the root of this package. Keep that
* in mind if this file is moved.
*/
$style_url = plugins_url( "/css/build/license{$suffix}.css", __DIR__ );
wp_enqueue_style( 'pll_license', $style_url, array(), Updater::get_version() );
$script_url = plugins_url( "/js/build/license{$suffix}.js", __DIR__ );
wp_enqueue_script( 'pll_license', $script_url, array( 'wp-api-fetch' ), Updater::get_version(), true );
}
/**
* Ajax method to deactivate a license.
* Hooked to `wp_ajax_pllu_deactivate_license`.
*
* Requires the class constant `DEACTIVATE_LICENSE_NONCE_ACTION`.
*
* @since 1.0
*
* @return void
*
* @phpstan-return never
*/
public function deactivate_license(): void {
check_ajax_referer( self::DEACTIVATE_LICENSE_NONCE_ACTION, '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
if ( ! isset( $_POST['id'] ) ) {
wp_die( 0 );
}
$id = substr( sanitize_text_field( wp_unslash( $_POST['id'] ) ), 11 );
$licenses = $this->get_licenses();
if ( ! isset( $licenses[ $id ] ) ) {
wp_die( 0 );
}
$license = $licenses[ $id ]->deactivate_license();
wp_send_json_success(
array(
'id' => $id,
'html' => $license->get_form_field(),
)
);
}
}
@@ -0,0 +1,737 @@
<?php
/**
* @package Polylang Updater
*
* Modified version with:
* - 'polylang-pro' text domain,
* - missing comments for translators,
* - a bug fix (https://github.com/polylang/updater/pull/14).
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use stdClass;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.9.4
*/
class EDD_SL_Plugin_Updater {
private $api_url = '';
private $api_data = array();
private $plugin_file = '';
private $name = '';
private $slug = '';
private $version = '';
private $wp_override = false;
private $beta = false;
private $failed_request_cache_key;
/**
* Class constructor.
*
* @uses plugin_basename()
* @uses hook()
*
* @param string $_api_url The URL pointing to the custom API endpoint.
* @param string $_plugin_file Path to the plugin file.
* @param array $_api_data Optional data to send with API calls.
*/
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
global $edd_plugin_data;
$this->api_url = trailingslashit( $_api_url );
$this->api_data = $_api_data;
$this->plugin_file = $_plugin_file;
$this->name = plugin_basename( $_plugin_file );
$this->slug = basename( dirname( $_plugin_file ) );
$this->version = $_api_data['version'];
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
$this->failed_request_cache_key = 'edd_sl_failed_http_' . md5( $this->api_url );
$edd_plugin_data[ $this->slug ] = $this->api_data;
/**
* Fires after the $edd_plugin_data is setup.
*
* @since x.x.x
*
* @param array $edd_plugin_data Array of EDD SL plugin data.
*/
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
// Set up hooks.
$this->init();
}
/**
* Set up WordPress filters to hook into WP's update process.
*
* @uses add_filter()
*
* @return void
*/
public function init() {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
add_action( 'after_plugin_row', array( $this, 'show_update_notification' ), 10, 2 );
add_action( 'admin_init', array( $this, 'show_changelog' ) );
}
/**
* Check for Updates at the defined API endpoint and modify the update array.
*
* This function dives into the update API just when WordPress creates its update array,
* then adds a custom API call and injects the custom plugin data retrieved from the API.
* It is reassembled from parts of the native WordPress plugin update code.
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
*
* @uses api_request()
*
* @param array $_transient_data Update array build by WordPress.
* @return array Modified update array with custom plugin data.
*/
public function check_update( $_transient_data ) {
if ( ! is_object( $_transient_data ) ) {
$_transient_data = new stdClass();
}
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
return $_transient_data;
}
$current = $this->get_update_transient_data();
if ( false !== $current && is_object( $current ) && isset( $current->new_version ) ) {
if ( version_compare( $this->version, $current->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $current;
} else {
// Populating the no_update information is required to support auto-updates in WordPress 5.5.
$_transient_data->no_update[ $this->name ] = $current;
}
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
return $_transient_data;
}
/**
* Get repo API data from store.
* Save to cache.
*
* @return \stdClass
*/
public function get_repo_api_data() {
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request(
'plugin_latest_version',
array(
'slug' => $this->slug,
'beta' => $this->beta,
)
);
if ( ! $version_info ) {
return false;
}
// This is required for your plugin to support auto-updates in WordPress 5.5.
$version_info->plugin = $this->name;
$version_info->id = $this->name;
$version_info->tested = $this->get_tested_version( $version_info );
if ( ! isset( $version_info->requires ) ) {
$version_info->requires = '';
}
if ( ! isset( $version_info->requires_php ) ) {
$version_info->requires_php = '';
}
$this->set_version_info_cache( $version_info );
}
// Added by Polylang.
$defaults = array(
'url' => '',
'package' => '',
'new_version' => '',
'tested' => '',
'requires' => '',
'requires_php' => '',
'icons' => new stdClass(),
'banners' => new stdClass(),
);
$version_info = (object) array_merge( $defaults, (array) $version_info );
// End of added by Polylang.
return $version_info;
}
/**
* Gets a limited set of data from the API response.
* This is used for the update_plugins transient.
*
* @since 3.8.12
* @return \stdClass|false
*/
private function get_update_transient_data() {
$version_info = $this->get_repo_api_data();
if ( ! $version_info ) {
return false;
}
$limited_data = new \stdClass();
$limited_data->slug = $this->slug;
$limited_data->plugin = $this->name;
$limited_data->url = $version_info->url;
$limited_data->package = $version_info->package;
$limited_data->icons = $this->convert_object_to_array( $version_info->icons );
$limited_data->banners = $this->convert_object_to_array( $version_info->banners );
$limited_data->new_version = $version_info->new_version;
$limited_data->tested = $version_info->tested;
$limited_data->requires = $version_info->requires;
$limited_data->requires_php = $version_info->requires_php;
return $limited_data;
}
/**
* Gets the plugin's tested version.
*
* @since 1.9.2
* @param object $version_info
* @return null|string
*/
private function get_tested_version( $version_info ) {
// There is no tested version.
if ( empty( $version_info->tested ) ) {
return null;
}
// Strip off extra version data so the result is x.y or x.y.z.
list( $current_wp_version ) = explode( '-', get_bloginfo( 'version' ) );
// The tested version is greater than or equal to the current WP version, no need to do anything.
if ( version_compare( $version_info->tested, $current_wp_version, '>=' ) ) {
return $version_info->tested;
}
$current_version_parts = explode( '.', $current_wp_version );
$tested_parts = explode( '.', $version_info->tested );
// The current WordPress version is x.y.z, so update the tested version to match it.
if ( isset( $current_version_parts[2] ) && $current_version_parts[0] === $tested_parts[0] && $current_version_parts[1] === $tested_parts[1] ) {
$tested_parts[2] = $current_version_parts[2];
}
return implode( '.', $tested_parts );
}
/**
* Show the update notification on multisite subsites.
*
* @param string $file
* @param array $plugin
*/
public function show_update_notification( $file, $plugin ) {
// Return early if in the network admin, or if this is not a multisite install.
if ( is_network_admin() || ! is_multisite() ) {
return;
}
// Allow single site admins to see that an update is available.
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
if ( $this->name !== $file ) {
return;
}
// Do not print any message if update does not exist.
$update_cache = get_site_transient( 'update_plugins' );
if ( ! isset( $update_cache->response[ $this->name ] ) ) {
if ( ! is_object( $update_cache ) ) {
$update_cache = new stdClass();
}
$update_cache->response[ $this->name ] = $this->get_repo_api_data();
}
// Return early if this plugin isn't in the transient->response or if the site is running the current or newer version of the plugin.
if ( empty( $update_cache->response[ $this->name ] ) || version_compare( $this->version, $update_cache->response[ $this->name ]->new_version, '>=' ) ) {
return;
}
printf(
'<tr class="plugin-update-tr %3$s" id="%1$s-update" data-slug="%1$s" data-plugin="%2$s">',
$this->slug,
$file,
in_array( $this->name, $this->get_active_plugins(), true ) ? 'active' : 'inactive'
);
echo '<td colspan="3" class="plugin-update colspanchange">';
echo '<div class="update-message notice inline notice-warning notice-alt"><p>';
$changelog_link = '';
if ( ! empty( $update_cache->response[ $this->name ]->sections->changelog ) ) {
$changelog_link = add_query_arg(
array(
'edd_sl_action' => 'view_plugin_changelog',
'plugin' => urlencode( $this->name ),
'slug' => urlencode( $this->slug ),
'TB_iframe' => 'true',
'width' => 77,
'height' => 911,
),
self_admin_url( 'index.php' )
);
}
$update_link = add_query_arg(
array(
'action' => 'upgrade-plugin',
'plugin' => urlencode( $this->name ),
),
self_admin_url( 'update.php' )
);
printf(
/* translators: the plugin name. */
esc_html__( 'There is a new version of %1$s available.', 'polylang-pro' ),
esc_html( $plugin['Name'] )
);
if ( ! current_user_can( 'update_plugins' ) ) {
echo ' ';
esc_html_e( 'Contact your network administrator to install the update.', 'polylang-pro' );
} elseif ( empty( $update_cache->response[ $this->name ]->package ) && ! empty( $changelog_link ) ) {
echo ' ';
printf(
/* translators: 1. opening anchor tag, do not translate 2. the new plugin version 3. closing anchor tag, do not translate. */
__( '%1$sView version %2$s details%3$s.', 'polylang-pro' ),
'<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
esc_html( $update_cache->response[ $this->name ]->new_version ),
'</a>'
);
} elseif ( ! empty( $changelog_link ) ) {
echo ' ';
printf(
/* translators: 1. and 4. are opening anchor tags 2. the new plugin version 3. and 5. are closing anchor tags. */
__( '%1$sView version %2$s details%3$s or %4$supdate now%5$s.', 'polylang-pro' ),
'<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
esc_html( $update_cache->response[ $this->name ]->new_version ),
'</a>',
'<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
'</a>'
);
} else {
printf(
' %1$s%2$s%3$s',
'<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
esc_html__( 'Update now.', 'polylang-pro' ),
'</a>'
);
}
do_action( "in_plugin_update_message-{$file}", $plugin, $plugin );
echo '</p></div></td></tr>';
}
/**
* Gets the plugins active in a multisite network.
*
* @return array
*/
private function get_active_plugins() {
$active_plugins = (array) get_option( 'active_plugins' );
$active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' );
return array_merge( $active_plugins, array_keys( $active_network_plugins ) );
}
/**
* Updates information on the "View version x.x details" page with custom data.
*
* @uses api_request()
*
* @param mixed $_data
* @param string $_action
* @param object $_args
* @return object $_data
*/
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
if ( 'plugin_information' !== $_action ) {
return $_data;
}
if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->slug ) ) {
return $_data;
}
$to_send = array(
'slug' => $this->slug,
'is_ssl' => is_ssl(),
'fields' => array(
'banners' => array(),
'reviews' => false,
'icons' => array(),
),
);
// Get the transient where we store the api request for this plugin for 24 hours
$edd_api_request_transient = $this->get_cached_version_info();
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
if ( empty( $edd_api_request_transient ) ) {
$api_response = $this->api_request( 'plugin_information', $to_send );
if ( empty( $api_response ) ) {
return $_data;
}
// Expires in 3 hours
$this->set_version_info_cache( $api_response );
$_data = $api_response;
} else {
$_data = $edd_api_request_transient;
}
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$_data->sections = $this->convert_object_to_array( $_data->sections );
}
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
$_data->banners = $this->convert_object_to_array( $_data->banners );
}
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if ( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
if ( ! isset( $_data->version ) && ! empty( $_data->new_version ) ) {
$_data->version = $_data->new_version;
}
return $_data;
}
/**
* Convert some objects to arrays when injecting data into the update API
*
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
*
* @since 3.6.5
*
* @param stdClass $data
*
* @return array
*/
private function convert_object_to_array( $data ) {
if ( ! is_array( $data ) && ! is_object( $data ) ) {
return array();
}
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
}
/**
* Disable SSL verification in order to prevent download update failures
*
* @param array $args
* @param string $url
* @return object $array
*/
public function http_request_args( $args, $url ) {
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
$args['sslverify'] = $this->verify_ssl();
}
return $args;
}
/**
* Calls the API and, if successfull, returns the object delivered by the API.
*
* @uses get_bloginfo()
* @uses wp_remote_post()
* @uses is_wp_error()
*
* @param string $_action The requested action.
* @param array $_data Parameters for the API action.
* @return false|object|void
*/
private function api_request( $_action, $_data ) {
$data = array_merge( $this->api_data, $_data );
if ( $data['slug'] !== $this->slug ) {
return;
}
// Don't allow a plugin to ping itself
if ( trailingslashit( home_url() ) === $this->api_url ) {
return false;
}
if ( $this->request_recently_failed() ) {
return false;
}
return $this->get_version_from_remote();
}
/**
* Determines if a request has recently failed.
*
* @since 1.9.1
*
* @return bool
*/
private function request_recently_failed() {
$failed_request_details = get_option( $this->failed_request_cache_key );
// Request has never failed.
if ( empty( $failed_request_details ) || ! is_numeric( $failed_request_details ) ) {
return false;
}
/*
* Request previously failed, but the timeout has expired.
* This means we're allowed to try again.
*/
if ( time() > $failed_request_details ) {
delete_option( $this->failed_request_cache_key );
return false;
}
return true;
}
/**
* Logs a failed HTTP request for this API URL.
* We set a timestamp for 1 hour from now. This prevents future API requests from being
* made to this domain for 1 hour. Once the timestamp is in the past, API requests
* will be allowed again. This way if the site is down for some reason we don't bombard
* it with failed API requests.
*
* @see EDD_SL_Plugin_Updater::request_recently_failed
*
* @since 1.9.1
*/
private function log_failed_request() {
update_option( $this->failed_request_cache_key, strtotime( '+1 hour' ) );
}
/**
* If available, show the changelog for sites in a multisite install.
*/
public function show_changelog() {
if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) {
return;
}
if ( empty( $_REQUEST['plugin'] ) ) {
return;
}
if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) {
return;
}
if ( ! current_user_can( 'update_plugins' ) ) {
wp_die( esc_html__( 'You do not have permission to install plugin updates', 'polylang-pro' ), esc_html__( 'Error', 'polylang-pro' ), array( 'response' => 403 ) );
}
$version_info = $this->get_repo_api_data();
if ( isset( $version_info->sections ) ) {
$sections = $this->convert_object_to_array( $version_info->sections );
if ( ! empty( $sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
}
}
exit;
}
/**
* Gets the current version information from the remote site.
*
* @return array|false
*/
private function get_version_from_remote() {
$api_params = array(
'edd_action' => 'get_version',
'license' => ! empty( $this->api_data['license'] ) ? $this->api_data['license'] : '',
'item_name' => isset( $this->api_data['item_name'] ) ? $this->api_data['item_name'] : false,
'item_id' => isset( $this->api_data['item_id'] ) ? $this->api_data['item_id'] : false,
'version' => isset( $this->api_data['version'] ) ? $this->api_data['version'] : false,
'slug' => $this->slug,
'author' => $this->api_data['author'],
'url' => home_url(),
'beta' => $this->beta,
'php_version' => phpversion(),
'wp_version' => get_bloginfo( 'version' ),
);
/**
* Filters the parameters sent in the API request.
*
* @param array $api_params The array of data sent in the request.
* @param array $this->api_data The array of data set up in the class constructor.
* @param string $this->plugin_file The full path and filename of the file.
*/
$api_params = apply_filters( 'edd_sl_plugin_updater_api_params', $api_params, $this->api_data, $this->plugin_file );
$request = wp_remote_post(
$this->api_url,
array(
'timeout' => 15,
'sslverify' => $this->verify_ssl(),
'body' => $api_params,
)
);
if ( is_wp_error( $request ) || ( 200 !== wp_remote_retrieve_response_code( $request ) ) ) {
$this->log_failed_request();
return false;
}
$request = json_decode( wp_remote_retrieve_body( $request ) );
if ( $request && isset( $request->sections ) ) {
$request->sections = maybe_unserialize( $request->sections );
} else {
$request = false;
}
if ( $request && isset( $request->banners ) ) {
$request->banners = maybe_unserialize( $request->banners );
}
if ( $request && isset( $request->icons ) ) {
$request->icons = maybe_unserialize( $request->icons );
}
if ( ! empty( $request->sections ) ) {
foreach ( $request->sections as $key => $section ) {
$request->$key = (array) $section;
}
}
return $request;
}
/**
* Get the version info from the cache, if it exists.
*
* @param string $cache_key
* @return object
*/
public function get_cached_version_info( $cache_key = '' ) {
if ( empty( $cache_key ) ) {
$cache_key = $this->get_cache_key();
}
$cache = get_option( $cache_key );
// Cache is expired
if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
return false;
}
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
$cache['value'] = json_decode( $cache['value'] );
if ( ! empty( $cache['value']->icons ) ) {
$cache['value']->icons = (array) $cache['value']->icons;
}
return $cache['value'];
}
/**
* Adds the plugin version information to the database.
*
* @param string $value
* @param string $cache_key
*/
public function set_version_info_cache( $value = '', $cache_key = '' ) {
if ( empty( $cache_key ) ) {
$cache_key = $this->get_cache_key();
}
$data = array(
'timeout' => strtotime( '+3 hours', time() ),
'value' => wp_json_encode( $value ),
);
update_option( $cache_key, $data, 'no' );
// Delete the duplicate option
delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
}
/**
* Returns if the SSL of the store should be verified.
*
* @since 1.6.13
* @return bool
*/
private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}
/**
* Gets the unique key (option name) for a plugin.
*
* @since 1.9.0
* @return string
*/
private function get_cache_key() {
$string = $this->slug . $this->api_data['license'] . $this->beta;
return 'edd_sl_' . md5( serialize( $string ) );
}
}
@@ -0,0 +1,393 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
defined( 'ABSPATH' ) || exit;
/**
* A class to easily manage licenses for Polylang Pro and addons.
*
* @since 1.0
*/
class License {
/**
* URL to Polylang's account page.
*
* @var string
*/
public const ACCOUNT_URL = 'https://polylang.pro/my-account/';
/**
* Sanitized plugin name.
*
* @var string
*/
public $id;
/**
* Plugin name.
*
* @var string
*/
public $name;
/**
* License key.
*
* @var string
*/
public $license_key;
/**
* License data, obtained from the API request.
*
* @var \stdClass|null
*/
public $license_data;
/**
* Main plugin file.
*
* @var string
*/
private $file;
/**
* Current plugin version.
*
* @var string
*/
private $version;
/**
* Plugin author.
*
* @var string
*/
private $author = 'WP SYNTEX';
/**
* API url.
*
* @var string.
*/
private $api_url = 'https://polylang.pro';
/**
* Constructor.
*
* @since 1.0
*
* @param string $file The plugin file.
* @param string $item_name The plugin name.
* @param string $version The plugin version.
*/
public function __construct( string $file, string $item_name, string $version ) {
$this->id = sanitize_title( $item_name );
$this->file = $file;
$this->name = $item_name;
$this->version = $version;
$licenses = (array) get_option( 'polylang_licenses', array() );
$license = isset( $licenses[ $this->id ] ) && is_array( $licenses[ $this->id ] ) ? $licenses[ $this->id ] : array();
$this->license_key = ! empty( $license['key'] ) ? (string) $license['key'] : '';
if ( ! empty( $license['data'] ) ) {
$this->license_data = (object) $license['data'];
}
// Updater.
$this->auto_updater();
// Register settings.
add_filter( 'pll_settings_modules', array( $this, 'settings_module' ) );
add_filter( 'pll_settings_licenses', array( $this, 'settings' ) );
// Weekly schedule.
if ( ! wp_next_scheduled( 'polylang_check_licenses' ) ) {
wp_schedule_event( time(), 'weekly', 'polylang_check_licenses' );
}
add_action( 'polylang_check_licenses', array( $this, 'check_license' ) );
}
/**
* Creates a new instance of the auto-updater.
*
* @since 1.0
*
* @return void
*/
public function auto_updater(): void {
$args = array(
'version' => $this->version,
'license' => $this->license_key,
'author' => $this->author,
'item_name' => $this->name,
);
// Setup the updater.
new EDD_SL_Plugin_Updater( $this->api_url, $this->file, $args );
}
/**
* Registers the settings module.
* Hooked to `pll_settings_modules`.
*
* @since 1.0
*
* @param string[] $modules The list of module classes.
* @return string[]
*/
public function settings_module( $modules ) {
/*
* Backward compatibility with Polylang < 3.7.
* Remove old license settings class to avoid duplicate.
*/
$modules = array_diff( $modules, array( 'PLL_Settings_Licenses' ) );
if ( empty( $modules['licenses'] ) ) {
$modules['licenses'] = Settings::class;
}
return $modules;
}
/**
* Registers the licence in the Settings.
* Hooked to `pll_settings_licenses`.
*
* @since 1.0
*
* @param License[] $items Array of objects allowing to manage a license.
* @return License[]
*/
public function settings( $items ) {
$items[ $this->id ] = $this;
return $items;
}
/**
* Activates the license key.
*
* @since 1.0
*
* @param string $license_key Activation key.
* @return self Updated License object.
*/
public function activate_license(
#[\SensitiveParameter]
string $license_key
): self {
$this->license_key = $license_key;
$this->api_request( 'activate_license' );
// Tell WordPress to look for updates.
delete_site_transient( 'update_plugins' );
return $this;
}
/**
* Deactivates the license key.
*
* @since 1.0
*
* @return self Updated License object.
*/
public function deactivate_license(): self {
$this->api_request( 'deactivate_license' );
return $this;
}
/**
* Checks if the license key is valid.
* Hooked to `polylang_check_licenses`.
*
* @since 1.0
*
* @return void
*/
public function check_license(): void {
$this->api_request( 'check_license' );
}
/**
* Sends an API request to check, activate or deactivate the license.
* Updates the licenses option according to the status.
*
* @since 1.0
*
* @param string $request Type of request: check_license | activate_license | deactivate_license.
* @return void
*
* @phpstan-param 'check_license'|'activate_license'|'deactivate_license' $request
*/
private function api_request( string $request ): void {
$licenses = get_option( 'polylang_licenses' );
if ( is_array( $licenses ) ) {
unset( $licenses[ $this->id ] );
} else {
$licenses = array();
}
unset( $this->license_data );
if ( ! empty( $this->license_key ) ) {
// Data to send in our API request.
$api_params = array(
'edd_action' => $request,
'license' => $this->license_key,
'item_name' => rawurlencode( $this->name ),
'url' => home_url(),
);
// Call the API.
$response = wp_remote_post(
$this->api_url,
array(
'timeout' => 3,
'sslverify' => false,
'body' => $api_params,
)
);
// Update the option only if we got a response.
if ( is_wp_error( $response ) ) {
return;
}
// Save new license info.
$licenses[ $this->id ] = array( 'key' => $this->license_key );
$data = (object) json_decode( wp_remote_retrieve_body( $response ) );
if ( isset( $data->license ) && 'deactivated' !== $data->license ) {
$licenses[ $this->id ]['data'] = $data;
$this->license_data = $data;
}
}
update_option( 'polylang_licenses', $licenses ); // FIXME called multiple times when saving all licenses.
}
/**
* Returns the HTML form field in a table row (one per license key) for display.
*
* @since 1.0
*
* @return string
*/
public function get_form_field(): string {
if ( ! empty( $this->license_data ) ) {
$license = $this->license_data;
}
$atts = array(
'id' => $this->id,
'name' => $this->name,
'license_key' => $this->license_key,
'row_class' => 'license-null',
'button_text' => '',
'message' => '',
);
if ( ! empty( $license ) && is_object( $license ) ) {
$now = time();
$expiration = isset( $license->expires ) ? strtotime( $license->expires ) : false;
// Special case: the license expired after the last check.
if ( $license->success && $expiration && $expiration < $now ) {
$license->success = false;
$license->error = 'expired';
}
if ( false === $license->success ) {
$atts['row_class'] = 'notice-error notice-alt';
if ( empty( $license->error ) && ! empty( $license->license ) ) {
$license->error = $license->license;
}
switch ( $license->error ) {
case 'expired':
$atts['message'] = sprintf(
/* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */
__( 'Your license key expired on %1$s. Please %2$srenew your license key%3$s.', 'polylang-pro' ),
date_i18n( get_option( 'date_format' ), $expiration ),
sprintf( '<a href="%s" target="_blank">', self::ACCOUNT_URL ),
'</a>'
);
break;
case 'disabled':
case 'revoked':
$atts['message'] = __( 'Your license key has been disabled.', 'polylang-pro' );
break;
case 'missing':
$atts['message'] = sprintf(
/* translators: %1$s is link start tag, %2$s is link end tag. */
__( 'Invalid license. Please %1$svisit your account page%2$s and verify it.', 'polylang-pro' ),
sprintf( '<a href="%s" target="_blank">', self::ACCOUNT_URL ),
'</a>'
);
break;
case 'invalid':
case 'site_inactive':
$atts['message'] = sprintf(
/* translators: %1$s is a product name, %2$s is link start tag, %3$s is link end tag. */
__( 'Your %1$s license key is not active for this URL. Please %2$svisit your account page%3$s to manage your license key URLs.', 'polylang-pro' ),
$this->name,
sprintf( '<a href="%s" target="_blank">', self::ACCOUNT_URL ),
'</a>'
);
break;
case 'item_name_mismatch':
/* translators: %s is a product name */
$atts['message'] = sprintf( __( 'This is not a %s license key.', 'polylang-pro' ), $this->name );
break;
case 'no_activations_left':
$atts['message'] = sprintf(
/* translators: %1$s is link start tag, %2$s is link end tag */
__( 'Your license key has reached its activation limit. %1$sView possible upgrades%2$s now.', 'polylang-pro' ),
sprintf( '<a href="%s" target="_blank">', self::ACCOUNT_URL ),
'</a>'
);
break;
}
} else {
$atts['row_class'] = 'license-valid';
$atts['button_text'] = __( 'Deactivate', 'polylang-pro' );
if ( 'lifetime' === $license->expires ) {
$atts['message'] = __( 'The license key never expires.', 'polylang-pro' );
} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
$atts['row_class'] = 'notice-warning notice-alt';
$atts['message'] = sprintf(
/* translators: %1$s is a date, %2$s is link start tag, %3$s is link end tag. */
__( 'Your license key will expire soon! Precisely, it will expire on %1$s. %2$sRenew your license key today!%3$s', 'polylang-pro' ),
date_i18n( get_option( 'date_format' ), $expiration ),
sprintf( '<a href="%s" target="_blank">', self::ACCOUNT_URL ),
'</a>'
);
} else {
$atts['message'] = sprintf(
/* translators: %s is a date */
__( 'Your license key expires on %s.', 'polylang-pro' ),
date_i18n( get_option( 'date_format' ), $expiration )
);
}
}
}
ob_start();
include __DIR__ . '/views/view-field-row.php';
return (string) ob_get_clean();
}
}
@@ -0,0 +1,198 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use PLL_License;
use PLL_Settings;
use PLL_Settings_Module;
use WP_Ajax_Response;
use WP_Error;
defined( 'ABSPATH' ) || exit;
/**
* Settings class for licenses.
*
* @since 1.0
*/
class Settings extends PLL_Settings_Module {
use Common_Trait;
/**
* Name of the ajax action to get the licenses data.
*
* @since 1.0
*
* @var string
*/
const GET_LICENSES_DATA_ACTION = 'pllu_get_licenses_data';
/**
* Name of the action to create the nonce required to deactivate a license.
*
* @since 1.0
*
* @var string
*/
const DEACTIVATE_LICENSE_NONCE_ACTION = 'pll_options';
/**
* Stores the display order priority.
*
* @var int
*/
public $priority = 100;
/**
* Constructor.
*
* @since 1.0
*
* @param PLL_Settings $polylang Polylang object.
*/
public function __construct( PLL_Settings &$polylang ) {
parent::__construct(
$polylang,
array(
'module' => 'licenses',
'title' => __( 'License keys', 'polylang-pro' ),
'description' => __( 'Manage licenses for Polylang Pro and add-ons.', 'polylang-pro' ),
)
);
$this->buttons['cancel'] = sprintf( '<button type="button" class="button button-secondary cancel">%s</button>', __( 'Close', 'polylang-pro' ) );
$this->hooks();
/*
* Useless because replaced by the following hook, so let's remove it so it doesn't clutter
* the global `$wp_filter`.
*/
remove_action( 'wp_ajax_pll_save_options', array( $this, 'save_options' ) );
/*
* Before `PLL_Settings_Module::save_options()`, to ensure that our response to
* ajax action is executed and not the Polylang legacy licenses system.
*/
add_action( 'wp_ajax_pll_save_options', array( $this, 'save_options' ), 5 );
add_action( 'wp_ajax_' . self::GET_LICENSES_DATA_ACTION, array( $this, 'display_licenses' ) );
}
/**
* Tells if the module is active.
*
* @since 1.0
*
* @return bool
*/
public function is_active(): bool {
return ! empty( $this->get_licenses() );
}
/**
* Displays the settings form.
*
* @since 1.0
*/
protected function form(): void {
if ( ! $this->is_active() ) {
return;
}
$atts = array(
'action' => self::GET_LICENSES_DATA_ACTION,
'nonce' => wp_create_nonce( self::GET_LICENSES_DATA_ACTION ),
);
include __DIR__ . '/views/view-settings-licenses.php';
}
/**
* Ajax method to save the license keys and activate the licenses at the same time.
* Overrides the parent's method.
*
* @since 1.0
*
* @return void
*/
public function save_options(): void {
check_ajax_referer( 'pll_options', '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
if ( ! isset( $_POST['module'] ) || $this->module !== $_POST['module'] || empty( $_POST['licenses'] ) ) {
return;
}
$response = new WP_Ajax_Response();
$what = 'success';
foreach ( $this->get_licenses() as $item ) {
if ( ! isset( $_POST['licenses'][ $item->id ] ) ) {
continue;
}
$updated_item = $item->activate_license( sanitize_key( $_POST['licenses'][ $item->id ] ) );
$response->Add(
array(
'what' => 'pllu-license-update',
'data' => $item->id,
'supplemental' => array( 'html' => $updated_item->get_form_field() ),
)
);
if ( empty( $updated_item->license_data->success ) ) {
$what = 'error';
}
}
// Updated message.
pll_add_notice( new WP_Error( 'settings_updated', __( 'Settings saved.', 'polylang-pro' ), 'success' ) );
ob_start();
settings_errors( 'polylang' );
$response->Add(
array(
'what' => $what,
'data' => (string) ob_get_clean(),
)
);
$response->send();
}
/**
* Ajax method to display licenses with their data (deactivation, expiration date).
* Hooked to `wp_ajax_pllu_get_licenses_data`.
*
* @since 1.0
*
* @return void
*
* @phpstan-return never
*/
public function display_licenses(): void {
check_ajax_referer( self::GET_LICENSES_DATA_ACTION, '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
$rows = array();
foreach ( $this->get_licenses() as $license ) {
$license->check_license(); // Get the license information from the server to ensure it's up to date.
$rows[] = $license->get_form_field();
}
wp_send_json_success(
array(
'row' => $rows,
)
);
}
}
@@ -0,0 +1,250 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use DateTime;
use stdClass;
defined( 'ABSPATH' ) || exit;
/**
* Allows to download translations from TranslationsPress.
* This is a modified version of the library available at https://github.com/WP-Translations/t15s-registry.
* This version supports only WP Syntex's plugins.
*
* @since 1.0
*/
class Translations {
/**
* Transient key.
*
* @var string
*/
public const TRANSIENT_KEY = 't15s-polylang';
/**
* TranslationsPress API URL for the company.
*
* @var string
*/
private const API_URL = 'https://packages.translationspress.com/wp-syntex/packages.json';
/**
* Project directory slug.
*
* @var string
*/
private $slug;
/**
* Installed translations.
*
* @var array|null
*/
private static $installed_translations;
/**
* Available languages.
*
* @var array|null
*/
private static $available_languages;
/**
* Adds a new project to load translations for.
*
* @since 1.0
*
* @param string $slug Project directory slug.
*/
public function __construct( string $slug ) {
$this->slug = $slug;
add_action( 'init', array( self::class, 'register_clean_translations_cache' ), 9999 );
add_filter( 'translations_api', array( $this, 'translations_api' ), 10, 3 );
add_filter( 'site_transient_update_plugins', array( $this, 'site_transient_update_plugins' ) );
}
/**
* Short-circuits translations API requests for private projects.
* Hooked to `translations_api`.
*
* @since 1.0
*
* @param bool|array $result The result object. Default false.
* @param string $requested_type The type of translations being requested.
* @param object $args Translation API arguments.
* @return bool|array
*/
public function translations_api( $result, $requested_type, $args ) {
$args = (array) $args; // The type of this param ins not clear in WP (object|array|null).
if ( 'plugins' === $requested_type && $this->slug === $args['slug'] ) {
return self::get_translations( $args['slug'] );
}
return $result;
}
/**
* Filters the translations transients to include the private plugin.
* Hooked to `site_transient_update_plugins`.
*
* @see wp_get_translation_updates().
*
* @since 1.0
*
* @param stdClass|false $value The transient value.
* @return stdClass|false
*/
public function site_transient_update_plugins( $value ) {
if ( ! $value instanceof stdClass ) {
$value = new stdClass();
}
if ( ! isset( $value->translations ) ) {
$value->translations = array();
}
$translations = self::get_translations( $this->slug );
if ( ! isset( $translations['translations'] ) ) {
return $value;
}
$installed_translations = self::get_installed_translations();
foreach ( (array) $translations['translations'] as $translation ) {
if ( in_array( $translation['language'], self::get_available_languages(), true ) ) {
if ( isset( $installed_translations[ $this->slug ][ $translation['language'] ] ) && $translation['updated'] ) {
$local = new DateTime( $installed_translations[ $this->slug ][ $translation['language'] ]['PO-Revision-Date'] );
$remote = new DateTime( $translation['updated'] );
if ( $local >= $remote ) {
continue;
}
}
$translation['type'] = 'plugin';
$translation['slug'] = $this->slug;
$value->translations[] = $translation;
}
}
return $value;
}
/**
* Registers actions for clearing translation caches.
* Hooked to `init`.
*
* @since 1.0
*
* @return void
*/
public static function register_clean_translations_cache(): void {
add_action( 'set_site_transient_update_plugins', array( self::class, 'clean_translations_cache' ) );
add_action( 'delete_site_transient_update_plugins', array( self::class, 'clean_translations_cache' ) );
}
/**
* Clears existing translation cache.
*
* @since 1.0
*
* @return void
*/
public static function clean_translations_cache(): void {
$translations = get_site_transient( self::TRANSIENT_KEY );
if ( ! is_object( $translations ) ) {
return;
}
/*
* Don't delete the cache if the transient gets changed multiple times
* during a single request. Set cache lifetime to maximum 15 seconds.
*/
$cache_lifespan = 15;
$time_not_changed = isset( $translations->_last_checked ) && ( time() - $translations->_last_checked ) > $cache_lifespan;
if ( ! $time_not_changed ) {
return;
}
delete_site_transient( self::TRANSIENT_KEY );
}
/**
* Returns the translations for a given project.
*
* @since 1.0
*
* @param string $slug Project directory slug.
* @return array Translation data.
*/
private static function get_translations( string $slug ): array {
$translations = get_site_transient( self::TRANSIENT_KEY );
if ( ! $translations instanceof stdClass ) {
$translations = new stdClass();
}
if ( isset( $translations->{$slug} ) && is_array( $translations->{$slug} ) ) {
return $translations->{$slug};
}
$translations = json_decode( wp_remote_retrieve_body( wp_remote_get( self::API_URL, array( 'timeout' => 3 ) ) ), true );
if ( is_array( $translations ) ) {
$translations = (object) $translations;
} else {
$translations = new stdClass();
}
$translations->_last_checked = time();
set_site_transient( self::TRANSIENT_KEY, $translations );
if ( isset( $translations->{$slug} ) && is_array( $translations->{$slug} ) ) {
return $translations->{$slug};
}
return array();
}
/**
* Returns installed translations.
*
* Used to cache the result of `wp_get_installed_translations()` as it is very expensive.
*
* @since 1.0
*
* @return array
*/
private static function get_installed_translations(): array {
if ( null === self::$installed_translations ) {
self::$installed_translations = wp_get_installed_translations( 'plugins' );
}
return self::$installed_translations;
}
/**
* Returns available languages.
*
* Used to cache the result of `get_available_languages()` as it is very expensive.
*
* @since 1.0
*
* @return array
*/
private static function get_available_languages(): array {
if ( null === self::$available_languages ) {
self::$available_languages = (array) get_available_languages();
}
return self::$available_languages;
}
}
@@ -0,0 +1,83 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use PLL_Base;
defined( 'ABSPATH' ) || exit;
/**
* Updater's main object for the given project.
*
* @since 1.0
*/
class Updater {
/**
* @var License
*/
public $license;
/**
* @var Translations
*/
public $translations;
/**
* @var Wizard_Licenses_Step|null
*/
public $wizard_licenses_step;
/**
* Constructor.
*
* Must be instantiated before `pll_init`.
* Should be instantiated in admin context (`\PLL_Admin_Base`).
*
* @since 1.0
*
* @param string $file The plugin file.
* @param string $name The plugin name.
* @param string $version The plugin version.
* @param string $text_domain Text domain for translations.
*/
public function __construct( string $file, string $name, string $version, string $text_domain ) {
$this->license = new License( $file, $name, $version );
$this->translations = new Translations( $text_domain );
add_action( 'pll_init', array( $this, 'load_wizard' ) );
}
/**
* Loads the wizard's step.
*
* @since 1.0
*
* @param PLL_Base $polylang Polylang object.
* @return void
*/
public function load_wizard( $polylang ): void {
if ( ! empty( $polylang->wizard ) ) {
$this->wizard_licenses_step = new Wizard_Licenses_Step( $polylang->wizard );
}
}
/**
* Returns the updater version.
*
* @since 1.0
*
* @return string
*/
public static function get_version(): string {
// Cache the version to avoid reading the file multiple times.
static $version = null;
if ( null === $version ) {
$version = require __DIR__ . '/../version.php';
}
return $version;
}
}
@@ -0,0 +1,177 @@
<?php
/**
* @package Polylang Updater
*/
namespace WP_Syntex\Polylang_Pro\Updater;
use PLL_Wizard;
defined( 'ABSPATH' ) || exit;
/**
* A class to handle the wizard license step.
* Must be instantiated on `pll_init` or later (after `PLL_Wizard` is instantiated).
*
* @since 1.0
*
* @phpstan-type Steps array<
* string,
* array{
* name: string,
* view: callable,
* handler: callable,
* scripts: non-falsy-string[],
* styles: non-falsy-string[]
* }
* >
*/
class Wizard_Licenses_Step {
use Common_Trait;
/**
* Name of the action to create the nonce required to deactivate a license.
*
* @since 1.0
*
* @var string
*/
const DEACTIVATE_LICENSE_NONCE_ACTION = 'pll-wizard';
/**
* Instance of the wizard.
*
* @var PLL_Wizard
*/
private $wizard;
/**
* Constructor.
*
* @since 1.0
*
* @param PLL_Wizard $wizard Instance of the wizard.
*/
public function __construct( PLL_Wizard $wizard ) {
$this->wizard = $wizard;
add_filter( 'pll_wizard_steps', array( $this, 'add' ), 101 ); // After `PLL_Wizard::add_step_licenses()`, so this can override it.
}
/**
* Adds licenses step to the wizard.
*
* @since 1.0
*
* @param array $steps List of steps.
* @return array List of steps updated.
*
* @phpstan-param Steps $steps
* @phpstan-return Steps
*/
public function add( $steps ) {
if ( isset( $steps['licenses']['view'] ) && is_array( $steps['licenses']['view'] ) && isset( $steps['licenses']['view'][0] ) ) {
$first_step = $steps['licenses']['view'][0];
if ( $first_step instanceof self ) {
// No need to execute this several times.
return $steps;
}
if ( $first_step instanceof PLL_Wizard ) {
// Remove the old system, so we don't send 2 AJAX requests for the same action (deactivate license).
remove_action( 'wp_ajax_pll_deactivate_license', array( $first_step, 'deactivate_license' ) );
wp_dequeue_script( 'pll_settings' );
}
}
$this->hooks();
if ( ! empty( $this->get_licenses() ) ) {
$steps['licenses'] = array(
'name' => esc_html__( 'Licenses', 'polylang-pro' ),
'view' => array( $this, 'display' ),
'handler' => array( $this, 'save' ),
'scripts' => array( 'pll_license' ),
'styles' => array( 'pll_license' ),
);
}
return $steps;
}
/**
* Displays the languages step form.
*
* @since 1.0
*
* @return void
*/
public function display(): void {
$atts = array(
'license_rows' => array(),
'is_error' => isset( $_GET['activate_error'] ) && 'i18n_license_key_error' === sanitize_key( $_GET['activate_error'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
);
foreach ( $this->get_licenses() as $license ) {
$atts['license_rows'][] = $license->get_form_field();
}
include __DIR__ . '/views/view-wizard-step-licenses.php';
}
/**
* Executes the languages step.
*
* @since 1.0
*
* @return void
*
* @phpstan-return never
*/
public function save(): void {
// User capabilities verified in `PLL_Wizard::setup_wizard_page()`.
check_admin_referer( 'pll-wizard', '_pll_nonce' );
$redirect = $this->wizard->get_next_step_link();
foreach ( $this->get_licenses() as $license ) {
if ( ! isset( $_POST['licenses'][ $license->id ] ) ) {
continue;
}
$updated_license = $license->activate_license( sanitize_key( $_POST['licenses'][ $license->id ] ) );
if ( empty( $updated_license->license_data ) || false !== $updated_license->license_data->success ) {
// Success.
continue;
}
// Stay on this step with an error.
$redirect = add_query_arg(
array(
'step' => $this->get_current_step(),
'activate_error' => 'i18n_license_key_error',
)
);
}
wp_safe_redirect( sanitize_url( $redirect ) );
exit;
}
/**
* Returns the current step.
*
* @since 1.0
* @see PLL_Wizard::setup_wizard_page()
*
* @return string
*/
private function get_current_step(): string {
/** This filter is documented in `PLL_Wizard::setup_wizard_page()`. */
$steps = apply_filters( 'pll_wizard_steps', array() );
$step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : false; // phpcs:ignore WordPress.Security.NonceVerification
// @phpstan-var non-empty-array<string, array> $steps
// @phpstan-var string|false $step
return $step && array_key_exists( $step, $steps ) ? $step : key( $steps );
}
}
@@ -0,0 +1,51 @@
<?php
/**
* Displays a license field.
*
* Note: the name of the input is intentionally not prefixed to easily manage
* the Polylang legacy licenses system at the same time.
*
* @package Polylang Updater
*
* @since 1.0
*
* @var array $atts {
* @type string $id ID of the plugin.
* @type string $name Name of the plugin.
* @type string $license_key License key.
* @type string $row_class HTML class for the row.
* @type string $button_text Optional. Text for the deactivation button.
* @type string $message Optional. Message displayed under the field.
* }
*/
use WP_Syntex\Polylang_Pro\Updater\License;
defined( 'ABSPATH' ) || exit;
$tags = array(
'a' => array(
'href' => array(
'values' => array( License::ACCOUNT_URL ),
),
'target' => true,
),
);
?>
<tr id="pllu-license-<?php echo esc_attr( $atts['id'] ); ?>" class="<?php echo esc_attr( $atts['row_class'] ); ?>">
<td><label for="pllu-licenses[<?php echo esc_attr( $atts['id'] ); ?>]"><?php echo esc_html( $atts['name'] ); ?></label></td>
<td><input name="licenses[<?php echo esc_attr( $atts['id'] ); ?>]" id="pllu-licenses[<?php echo esc_attr( $atts['id'] ); ?>]" type="password" value="<?php echo esc_attr( $atts['license_key'] ); ?>" class="regular-text code" />
<?php
if ( ! empty( $atts['button_text'] ) ) {
?>
<button id="deactivate_<?php echo esc_attr( $atts['id'] ); ?>" type="button" class="button button-secondary pllu-deactivate-license"><?php echo esc_html( $atts['button_text'] ); ?></button>
<?php
}
if ( ! empty( $atts['message'] ) ) {
?>
<p><?php echo wp_kses( $atts['message'], $tags ); ?></p>
<?php
}
?>
</tr>
@@ -0,0 +1,18 @@
<?php
/**
* Displays the licenses table.
*
* @package Polylang Updater
*
* @since 1.0
*
* @var array $atts {
* @type string $action AJAX action.
* @type string $nonce AJAX nonce.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<table id="pllu-licenses-table" class="form-table pll-table-top" data-action="<?php echo esc_attr( $atts['action'] ); ?>" data-nonce="<?php echo esc_attr( $atts['nonce'] ); ?>"></table>
@@ -0,0 +1,37 @@
<?php
/**
* Displays the wizard licenses step.
*
* @package Polylang Updater
*
* @since 1.0
*
* @var array $atts {
* @type string[] $license_rows The license fields.
* @type bool $is_error Whether there is an error with a license key.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<p>
<?php esc_html_e( 'You are using plugins which require a license key.', 'polylang-pro' ); ?>
<?php echo esc_html( _n( 'Please enter your license key:', 'Please enter your license keys:', count( $atts['license_rows'] ), 'polylang-pro' ) ); ?>
</p>
<h2><?php esc_html_e( 'Licenses', 'polylang-pro' ); ?></h2>
<div id="messages">
<?php if ( $atts['is_error'] ) : ?>
<p class="error"><?php esc_html_e( 'There is an error with a license key.', 'polylang-pro' ); ?></p>
<?php endif; ?>
</div>
<div class="form-field">
<table id="pllu-licenses-table" class="form-table pll-table-top">
<tbody>
<?php
// Escaping is already done in get_form_field method.
echo implode( "\n", $atts['license_rows'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</tbody>
</table>
</div>
@@ -0,0 +1,15 @@
<?php
/**
* @package Polylang Updater
*/
// If uninstall not called from WordPress exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Deletes cache options generated by `EDD_SL_Plugin_Updater`.
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'edd\_sl\_%'" );
@@ -0,0 +1,8 @@
<?php
/**
* @package Polylang Updater
*/
defined( 'ABSPATH' ) || exit;
return '1.0.0';
@@ -0,0 +1,58 @@
/******/ "use strict";
;// ./vendor/wpsyntex/polylang/js/src/lib/ajax-filter/index.js
/**
* @package Polylang
*/
/**
* Adds data to all ajax requests made with jQuery.
*
* @since 3.7
*
* @param {Object} data The data to add.
* @returns {void}
*/
function ajaxFilter( data ) {
if ( 'undefined' === typeof jQuery || ! data ) {
return;
}
const dataStr = jQuery.param( data );
jQuery.ajaxPrefilter( function ( options ) {
if ( -1 === options.url.indexOf( ajaxurl ) && -1 === ajaxurl.indexOf( options.url ) ) {
return;
}
if (
'undefined' === typeof options.data ||
null === options.data ||
'string' === typeof options.data && '' === options.data.trim()
) {
// An empty string or null/undefined.
options.data = dataStr;
} else if ( 'string' === typeof options.data ) {
// A non-empty string: can be a JSON string or a query string.
try {
options.data = JSON.stringify( Object.assign( JSON.parse( options.data ), data ) );
} catch ( exception ) {
// A non-empty non-JSON string is considered a query string.
options.data = `${ options.data }&${ dataStr }`;
}
} else if ( jQuery.isPlainObject( options.data ) ) {
// An object.
options.data = Object.assign( options.data, data );
}
} );
}
;// ./vendor/wpsyntex/polylang/js/src/admin.js
/**
* @package Polylang
*/
ajaxFilter( pll_admin?.ajax_filter );
+1
View File
@@ -0,0 +1 @@
"use strict";function ajaxFilter(a){if("undefined"==typeof jQuery||!a)return;const t=jQuery.param(a);jQuery.ajaxPrefilter((function(e){if(-1!==e.url.indexOf(ajaxurl)||-1!==ajaxurl.indexOf(e.url))if(void 0===e.data||null===e.data||"string"==typeof e.data&&""===e.data.trim())e.data=t;else if("string"==typeof e.data)try{e.data=JSON.stringify(Object.assign(JSON.parse(e.data),a))}catch(a){e.data=`${e.data}&${t}`}else jQuery.isPlainObject(e.data)&&(e.data=Object.assign(e.data,a))}))}ajaxFilter(pll_admin?.ajax_filter);
@@ -0,0 +1,460 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 631
(module) {
module.exports = (function() { return this["wp"]["apiFetch"]; }());
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
;// ./vendor/wpsyntex/polylang/js/src/lib/confirmation-modal.js
/**
* @package Polylang
*/
const languagesList = jQuery('.post_lang_choice');
// Dialog box for alerting the user about a risky changing.
const initializeConfirmationModal = () => {
// We can't use underscore or lodash in this common code because it depends of the context classic or block editor.
// Classic editor underscore is loaded, Block editor lodash is loaded.
const {
__
} = wp.i18n;
// Create dialog container.
const dialogContainer = jQuery('<div/>', {
id: 'pll-dialog',
style: 'display:none;'
}).text(__('Are you sure you want to change the language of the current content?', 'polylang'));
// Put it after languages list dropdown.
// PHPCS ignore dialogContainer is a new safe HTML code generated above.
languagesList.after(dialogContainer); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after
const dialogResult = new Promise((confirm, cancel) => {
const confirmDialog = what => {
// phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
switch (what) {
// phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
case 'yes':
// Confirm the new language.
languagesList.data('old-value', languagesList.children(':selected').first().val());
confirm();
break;
case 'no':
// Revert to the old language.
languagesList.val(languagesList.data('old-value'));
cancel('Cancel');
break;
}
dialogContainer.dialog('close'); // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
}; // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
// Initialize dialog box in the case a language is selected but not added in the list.
const dialogOptions = {
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __('Change language', 'polylang'),
minWidth: 600,
maxWidth: '100%',
open: function (event, ui) {
// Change dialog box position for rtl language
if (jQuery('body').hasClass('rtl')) {
jQuery(this).parent().css({
right: jQuery(this).parent().css('left'),
left: 'auto'
});
}
},
close: function (event, ui) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog('no');
},
buttons: [{
text: __('OK', 'polylang'),
click: function (event) {
confirmDialog('yes');
}
}, {
text: __('Cancel', 'polylang'),
click: function (event) {
confirmDialog('no');
}
}]
};
if (jQuery.ui.version >= '1.12.0') {
Object.assign(dialogOptions, {
classes: {
'ui-dialog': 'pll-confirmation-modal'
}
});
} else {
Object.assign(dialogOptions, {
dialogClass: 'pll-confirmation-modal'
}); // jQuery UI 1.11.4 - WP < 5.6
}
dialogContainer.dialog(dialogOptions);
});
return {
dialogContainer,
dialogResult
};
};
const initializeLanguageOldValue = () => {
// Keep the old language value to be able to compare to the new one and revert to it if necessary.
languagesList.attr('data-old-value', languagesList.children(':selected').first().val());
};
;// ./vendor/wpsyntex/polylang/js/src/lib/metabox-autocomplete.js
/**
* @package Polylang
*/
// Translations autocomplete input box.
function initMetaboxAutoComplete() {
jQuery('.tr_lang').each(function () {
var tr_lang = jQuery(this).attr('id').substring(8);
var td = jQuery(this).parent().parent().siblings('.pll-edit-column');
jQuery(this).autocomplete({
minLength: 0,
source: ajaxurl + '?action=pll_posts_not_translated' + '&post_language=' + jQuery('.post_lang_choice').val() + '&translation_language=' + tr_lang + '&post_type=' + jQuery('#post_type').val() + '&_pll_nonce=' + jQuery('#_pll_nonce').val(),
select: function (event, ui) {
jQuery('#htr_lang_' + tr_lang).val(ui.item.id);
// ui.item.link is built and come from server side and is well escaped when necessary
td.html(ui.item.link); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
}
});
// when the input box is emptied
jQuery(this).on('blur', function () {
if (!jQuery(this).val()) {
jQuery('#htr_lang_' + tr_lang).val(0);
// Value is retrieved from HTML already generated server side
td.html(td.siblings('.hidden').children().clone()); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
}
});
});
}
// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
var external_this_wp_apiFetch_ = __webpack_require__(631);
var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
;// ./node_modules/@wpsyntex/polylang-react-library/build/middlewares/filter-path.js
/**
* Filters requests for translatable entities.
* This logic is shared across all Polylang plugins.
*
* @since 3.5
*
* @param {Object} options - API fetch options object.
* @param {Array} filteredRoutes - Array of route paths to filter.
* @param {Function} filter - Function to filter matching routes.
* @return {Object} Modified REST request options.
*/
const filterPathMiddleware = (options, filteredRoutes, filter) => {
const cleanPath = options.path.split('?')[0].replace(/^\/+|\/+$/g, ''); // Get path without query parameters and trim '/'.
return Object.values(filteredRoutes).find(path => cleanPath === path) ? filter(options) : options;
};
/* harmony default export */ const filter_path = (filterPathMiddleware);
;// ./node_modules/@wpsyntex/polylang-react-library/build/middlewares/editors-requests-filter.js
/**
* WordPress dependencies.
*/
/*
* Internal dependencies.
*/
/**
* Safely filters requests for translatable entities in block editor type screens.
* Ensures that `pllFilteredRoutes` has been well defined on server side and
* that the filtered request is a REST one.
*
* @param {Function} filterCallback - Function to filter API fetch options.
*/
const editorsRequestsFilter = filterCallback => {
external_this_wp_apiFetch_default().use((options, next) => {
/*
* If options.url is defined, this is not a REST request but a direct call to post.php for legacy metaboxes.
* If `filteredRoutes` is not defined, return early.
*/
if ('undefined' !== typeof options.url || 'undefined' === typeof window.pllFilteredRoutes) {
return next(options);
}
return next(filter_path(options, window.pllFilteredRoutes, filterCallback));
});
};
/* harmony default export */ const editors_requests_filter = (editorsRequestsFilter);
;// ./vendor/wpsyntex/polylang/js/src/block-editor.js
/**
* @package Polylang
*/
/**
* Gets the language of the currently edited post, fallback to default language if none is found.
*
* @since 2.5
*
* @return {Element.value}
*/
function getCurrentLanguage() {
const lang = document.querySelector('[name=post_lang_choice]');
if (null === lang) {
return pllDefaultLanguage;
}
return lang.value;
}
/**
* Adds language parameter according to the current one (query string for GET, body for PUT and POST).
*
* @since 3.5
*
* @param {APIFetchOptions} options
* @returns {APIFetchOptions}
*/
function addLanguageParameter(options) {
if ('undefined' === typeof options.data || null === options.data) {
// GET
options.path += (options.path.indexOf('?') >= 0 ? '&lang=' : '?lang=') + getCurrentLanguage();
} else {
// PUT, POST
options.data.lang = getCurrentLanguage();
}
return options;
}
/**
* Filter REST API requests to add the language in the request
*
* @since 2.5
*/
editors_requests_filter(addLanguageParameter);
/**
* Handles internals of the metabox:
* Language select, autocomplete input field.
*
* @since 1.5
*
* Save post after lang choice is done and redirect to the same page for refreshing all the data.
*
* @since 2.5
*
* Link post saving after refreshing the metabox.
*
* @since 3.0
*/
jQuery(function ($) {
// Initialize current language to be able to compare if it changes.
initializeLanguageOldValue();
// Ajax for changing the post's language in the languages metabox
$('.post_lang_choice').on('change', function (event) {
const {
select,
dispatch,
subscribe
} = wp.data;
const emptyPost = isEmptyPost();
const {
addQueryArgs
} = wp.url;
// Initialize the confirmation dialog box.
const confirmationModal = initializeConfirmationModal();
const {
dialogContainer: dialog
} = confirmationModal;
let {
dialogResult
} = confirmationModal;
const selectedOption = event.target; // The selected option in the dropdown list.
// Specific case for empty posts.
// Place at the beginning because window.location change triggers automatically page reloading.
if (location.pathname.match(/post-new.php/gi) && emptyPost) {
reloadPageForEmptyPost(selectedOption.value);
}
// Otherwise send an ajax request to refresh the legacy metabox and set the post language with the new language.
// It needs a confirmation of the user before changing the language.
// Need to wait the ajax response before triggering the block editor post save action.
if ($(this).data('old-value') !== selectedOption.value && !emptyPost) {
dialog.dialog('open');
} else {
// Update the old language with the new one to be able to compare it in the next change.
// Because the page isn't reloaded in this case.
initializeLanguageOldValue();
dialogResult = Promise.resolve();
}
dialogResult.then(() => {
let data = {
// phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
action: 'post_lang_choice',
lang: selectedOption.value,
post_type: $('#post_type').val(),
post_id: $('#post_ID').val(),
_pll_nonce: $('#_pll_nonce').val()
};
// Update post language in database as soon as possible.
// Because, in addition of the block editor save process, the legacy metabox uses a post.php process to update the language and is too late compared to the page reload.
$.post(ajaxurl, data, function () {
blockEditorSavePostAndReloadPage();
});
}, () => {} // Do nothing when promise is rejected by clicking the Cancel dialog button.
);
function isEmptyPost() {
const editor = select('core/editor');
return !editor.getEditedPostAttribute('title')?.trim() && !editor.getEditedPostContent() && !editor.getEditedPostAttribute('excerpt')?.trim();
}
/**
* Reload the block editor page for empty posts.
*
* @param {string} lang The target language code.
*/
function reloadPageForEmptyPost(lang) {
// Change the new_lang parameter with the new language value for reloading the page
// WPCS location.search is never written in the page, just used to reload page with the right value of new_lang
// new_lang input is controlled server side in PHP. The value come from the dropdown list of language returned and escaped server side.
// Notice that window.location changing triggers automatically page reloading.
if (-1 != location.search.indexOf('new_lang')) {
// use regexp non capturing group to replace new_lang parameter no matter where it is and capture other parameters which can be behind it
window.location.search = window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/, 'new_lang=' + lang + '$1$2'); // phpcs:ignore WordPressVIPMinimum.JS.Window.location, WordPressVIPMinimum.JS.Window.VarAssignment
} else {
window.location.search = window.location.search + (-1 != window.location.search.indexOf('?') ? '&' : '?') + 'new_lang=' + lang; // phpcs:ignore WordPressVIPMinimum.JS.Window.location, WordPressVIPMinimum.JS.Window.VarAssignment
}
}
;
/**
* Triggers block editor post save and reload the block editor page when everything is ok.
*/
function blockEditorSavePostAndReloadPage() {
let unsubscribe = null;
const previousPost = select('core/editor').getCurrentPost();
// Listen if the savePost is completely done by subscribing to its events.
const savePostIsDone = new Promise(function (resolve, reject) {
unsubscribe = subscribe(function () {
const post = select('core/editor').getCurrentPost();
const {
id,
status,
type
} = post;
const error = select('core').getLastEntitySaveError('postType', type, id);
if (error) {
reject();
}
if (previousPost.modified !== post.modified) {
if (location.pathname.match(/post-new.php/gi) && status !== 'auto-draft' && id) {
window.history.replaceState({
id
}, 'Post ' + id, addQueryArgs('post.php', {
post: id,
action: 'edit'
}));
}
resolve();
}
});
});
// Triggers the post save.
dispatch('core/editor').savePost();
// Process
savePostIsDone.then(function () {
// If the post is well saved, we can reload the page
window.location.reload();
}, function () {
// If the post save failed
unsubscribe();
}).catch(function () {
// If an exception is thrown
unsubscribe();
});
}
;
});
initMetaboxAutoComplete();
});
})();
this["polylang-pro"] = __webpack_exports__;
/******/ })()
;
@@ -0,0 +1 @@
(()=>{var t={631(t){t.exports=function(){return this.wp.apiFetch}()}},e={};function n(o){var a=e[o];if(void 0!==a)return a.exports;var l=e[o]={exports:{}};return t[o](l,l.exports,n),l.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);(()=>{"use strict";const t=jQuery(".post_lang_choice"),e=()=>{const{__:e}=wp.i18n,n=jQuery("<div/>",{id:"pll-dialog",style:"display:none;"}).text(e("Are you sure you want to change the language of the current content?","polylang"));t.after(n);const o=new Promise(((o,a)=>{const l=e=>{switch(e){case"yes":t.data("old-value",t.children(":selected").first().val()),o();break;case"no":t.val(t.data("old-value")),a("Cancel")}n.dialog("close")},i={autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:e("Change language","polylang"),minWidth:600,maxWidth:"100%",open:function(t,e){jQuery("body").hasClass("rtl")&&jQuery(this).parent().css({right:jQuery(this).parent().css("left"),left:"auto"})},close:function(t,e){l("no")},buttons:[{text:e("OK","polylang"),click:function(t){l("yes")}},{text:e("Cancel","polylang"),click:function(t){l("no")}}]};jQuery.ui.version>="1.12.0"?Object.assign(i,{classes:{"ui-dialog":"pll-confirmation-modal"}}):Object.assign(i,{dialogClass:"pll-confirmation-modal"}),n.dialog(i)}));return{dialogContainer:n,dialogResult:o}},o=()=>{t.attr("data-old-value",t.children(":selected").first().val())};var a=n(631),l=n.n(a);const i=(t,e,n)=>{const o=t.path.split("?")[0].replace(/^\/+|\/+$/g,"");return Object.values(e).find((t=>o===t))?n(t):t};function r(){const t=document.querySelector("[name=post_lang_choice]");return null===t?pllDefaultLanguage:t.value}(t=>{l().use(((e,n)=>void 0!==e.url||void 0===window.pllFilteredRoutes?n(e):n(i(e,window.pllFilteredRoutes,t))))})((function(t){return void 0===t.data||null===t.data?t.path+=(t.path.indexOf("?")>=0?"&lang=":"?lang=")+r():t.data.lang=r(),t})),jQuery((function(t){o(),t(".post_lang_choice").on("change",(function(n){const{select:a,dispatch:l,subscribe:i}=wp.data,r=function(){const t=a("core/editor");return!t.getEditedPostAttribute("title")?.trim()&&!t.getEditedPostContent()&&!t.getEditedPostAttribute("excerpt")?.trim()}(),{addQueryArgs:s}=wp.url,c=e(),{dialogContainer:u}=c;let{dialogResult:d}=c;const p=n.target;var g;location.pathname.match(/post-new.php/gi)&&r&&(g=p.value,-1!=location.search.indexOf("new_lang")?window.location.search=window.location.search.replace(/(?:new_lang=[^&]*)(&)?(.*)/,"new_lang="+g+"$1$2"):window.location.search=window.location.search+(-1!=window.location.search.indexOf("?")?"&":"?")+"new_lang="+g),t(this).data("old-value")===p.value||r?(o(),d=Promise.resolve()):u.dialog("open"),d.then((()=>{let e={action:"post_lang_choice",lang:p.value,post_type:t("#post_type").val(),post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,e,(function(){!function(){let t=null;const e=a("core/editor").getCurrentPost(),n=new Promise((function(n,o){t=i((function(){const t=a("core/editor").getCurrentPost(),{id:l,status:i,type:r}=t;a("core").getLastEntitySaveError("postType",r,l)&&o(),e.modified!==t.modified&&(location.pathname.match(/post-new.php/gi)&&"auto-draft"!==i&&l&&window.history.replaceState({id:l},"Post "+l,s("post.php",{post:l,action:"edit"})),n())}))}));l("core/editor").savePost(),n.then((function(){window.location.reload()}),(function(){t()})).catch((function(){t()}))}()}))}),(()=>{}))})),jQuery(".tr_lang").each((function(){var t=jQuery(this).attr("id").substring(8),e=jQuery(this).parent().parent().siblings(".pll-edit-column");jQuery(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+jQuery(".post_lang_choice").val()+"&translation_language="+t+"&post_type="+jQuery("#post_type").val()+"&_pll_nonce="+jQuery("#_pll_nonce").val(),select:function(n,o){jQuery("#htr_lang_"+t).val(o.item.id),e.html(o.item.link)}}),jQuery(this).on("blur",(function(){jQuery(this).val()||(jQuery("#htr_lang_"+t).val(0),e.html(e.siblings(".hidden").children().clone()))}))}))}))})(),this["polylang-pro"]={}})();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,91 @@
/**
* Bulk translate
*
* @package Polylang-Pro
*/
jQuery(
function ( $ ) {
var t = this;
$( '.editinline' ).on(
'click',
function () {
$( '#pll-translate' ).find( '.cancel' ).trigger( 'click' ); // Close the form on quick edit
}
);
$( '#doaction, #doaction2' ).on(
'click',
function ( e ) {
t.whichBulkButtonId = $( this ).attr( 'id' );
var n = t.whichBulkButtonId.substr( 2 );
if ( 'pll_translate' === $( 'select[name="' + n + '"]' ).val() ) {
e.preventDefault();
if ( typeof inlineEditPost !== 'undefined' ) { // Not available for media.
inlineEditPost.revert(); // Close Bulk edit and Quick edit if open.
}
$( '#pll-translate td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
// The hidden tr allows to keep the background color.
// HTML prepended is hardcoded. So prepend is safe and as no need to be escaped.
$( 'table.widefat tbody' ).prepend( $( '#pll-translate' ) ).prepend( '<tr class="hidden"></tr>' ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
// Set initial focus on the Bulk translate region.
$( '#pll-translate .inline-edit-wrapper' ).attr( 'tabindex', '-1' ).focus();
// Scrolls to the top of the table where the editor is rendered.
$('html, body').animate( { scrollTop: 0 }, 'fast' );
} else {
$( '#pll-translate' ).find( '.cancel' ).trigger( 'click' );
}
}
);
// Cancel
$( '#pll-translate' ).on(
'click',
'.cancel',
function () {
// Close the form on any other bulk action
$( '#pll-translate' ).siblings( '.hidden' ).remove();
// #pll-translate is built and come from server side and is well escaped when necessary
$( '#pll-bulk-translate' ).append( $( '#pll-translate' ) ); //phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
// Move focus back to the Bulk Action button that was activated.
$( '#' + t.whichBulkButtonId ).trigger( 'focus' );
}
);
// Act when pressing enter or esc
$( '#pll-translate' ).on(
'keydown',
function ( event ) {
if ( 'Enter' === event.key && ! $( event.target ).hasClass( 'cancel' ) ) {
event.preventDefault();
$( this ).find( 'input[type=submit]' ).trigger( 'click' );
}
if ( 'Escape' === event.key ) {
event.preventDefault();
$( this ).find( '.cancel' ).trigger( 'click' );
}
}
);
// Clean DOM in case of file download
$( '#posts-filter' ).on(
'submit',
function () {
$( '.settings-error' ).remove();
setTimeout(
function () {
$( 'input[type=checkbox]:checked' ).attr( 'checked', false );
$( '#pll-translate' ).find( '.cancel' ).trigger( 'click' );
},
500
);
}
);
}
);
@@ -0,0 +1 @@
jQuery((function(t){var e=this;t(".editinline").on("click",(function(){t("#pll-translate").find(".cancel").trigger("click")})),t("#doaction, #doaction2").on("click",(function(n){e.whichBulkButtonId=t(this).attr("id");var l=e.whichBulkButtonId.substr(2);"pll_translate"===t('select[name="'+l+'"]').val()?(n.preventDefault(),"undefined"!=typeof inlineEditPost&&inlineEditPost.revert(),t("#pll-translate td").attr("colspan",t("th:visible, td:visible",".widefat:first thead").length),t("table.widefat tbody").prepend(t("#pll-translate")).prepend('<tr class="hidden"></tr>'),t("#pll-translate .inline-edit-wrapper").attr("tabindex","-1").focus(),t("html, body").animate({scrollTop:0},"fast")):t("#pll-translate").find(".cancel").trigger("click")})),t("#pll-translate").on("click",".cancel",(function(){t("#pll-translate").siblings(".hidden").remove(),t("#pll-bulk-translate").append(t("#pll-translate")),t("#"+e.whichBulkButtonId).trigger("focus")})),t("#pll-translate").on("keydown",(function(e){"Enter"!==e.key||t(e.target).hasClass("cancel")||(e.preventDefault(),t(this).find("input[type=submit]").trigger("click")),"Escape"===e.key&&(e.preventDefault(),t(this).find(".cancel").trigger("click"))})),t("#posts-filter").on("submit",(function(){t(".settings-error").remove(),setTimeout((function(){t("input[type=checkbox]:checked").attr("checked",!1),t("#pll-translate").find(".cancel").trigger("click")}),500)}))}));
@@ -0,0 +1,466 @@
/******/ "use strict";
;// ./vendor/wpsyntex/polylang/js/src/lib/confirmation-modal.js
/**
* @package Polylang
*/
const languagesList = jQuery( '.post_lang_choice' );
// Dialog box for alerting the user about a risky changing.
const initializeConfirmationModal = () => {
// We can't use underscore or lodash in this common code because it depends of the context classic or block editor.
// Classic editor underscore is loaded, Block editor lodash is loaded.
const { __ } = wp.i18n;
// Create dialog container.
const dialogContainer = jQuery(
'<div/>',
{
id: 'pll-dialog',
style: 'display:none;'
}
).text( __( 'Are you sure you want to change the language of the current content?', 'polylang' ) );
// Put it after languages list dropdown.
// PHPCS ignore dialogContainer is a new safe HTML code generated above.
languagesList.after( dialogContainer ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after
const dialogResult = new Promise(
( confirm, cancel ) => {
const confirmDialog = ( what ) => { // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
switch ( what ) { // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
case 'yes':
// Confirm the new language.
languagesList.data( 'old-value', languagesList.children( ':selected' ).first().val() );
confirm();
break;
case 'no':
// Revert to the old language.
languagesList.val( languagesList.data( 'old-value' ) );
cancel( 'Cancel' );
break;
}
dialogContainer.dialog( 'close' ); // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
} // phpcs:ignore PEAR.Functions.FunctionCallSignature.Indent
// Initialize dialog box in the case a language is selected but not added in the list.
const dialogOptions = {
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: __( 'Change language', 'polylang' ),
minWidth: 600,
maxWidth: '100%',
open: function ( event, ui ) {
// Change dialog box position for rtl language
if ( jQuery( 'body' ).hasClass( 'rtl' ) ) {
jQuery( this ).parent().css(
{
right: jQuery( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
},
close: function ( event, ui ) {
// When we're closing the dialog box we need to cancel the language change as we click on Cancel button.
confirmDialog( 'no' );
},
buttons: [
{
text: __( 'OK', 'polylang' ),
click: function ( event ) {
confirmDialog( 'yes' );
}
},
{
text: __( 'Cancel', 'polylang' ),
click: function ( event ) {
confirmDialog( 'no' );
}
}
]
};
if ( jQuery.ui.version >= '1.12.0' ) {
Object.assign( dialogOptions, { classes: { 'ui-dialog': 'pll-confirmation-modal' } } );
} else {
Object.assign( dialogOptions, { dialogClass: 'pll-confirmation-modal' } ); // jQuery UI 1.11.4 - WP < 5.6
}
dialogContainer.dialog( dialogOptions );
}
);
return { dialogContainer, dialogResult };
}
const initializeLanguageOldValue = () => {
// Keep the old language value to be able to compare to the new one and revert to it if necessary.
languagesList.attr( 'data-old-value', languagesList.children( ':selected' ).first().val() );
};
;// ./vendor/wpsyntex/polylang/js/src/lib/metabox-autocomplete.js
/**
* @package Polylang
*/
// Translations autocomplete input box.
function initMetaboxAutoComplete() {
jQuery('.tr_lang').each(
function () {
var tr_lang = jQuery(this).attr('id').substring(8);
var td = jQuery(this).parent().parent().siblings('.pll-edit-column');
jQuery(this).autocomplete(
{
minLength: 0,
source: ajaxurl + '?action=pll_posts_not_translated' +
'&post_language=' + jQuery('.post_lang_choice').val() +
'&translation_language=' + tr_lang +
'&post_type=' + jQuery('#post_type').val() +
'&_pll_nonce=' + jQuery('#_pll_nonce').val(),
select: function (event, ui) {
jQuery('#htr_lang_' + tr_lang).val(ui.item.id);
// ui.item.link is built and come from server side and is well escaped when necessary
td.html(ui.item.link); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
},
}
);
// when the input box is emptied
jQuery(this).on(
'blur',
function () {
if ( ! jQuery(this).val() ) {
jQuery('#htr_lang_' + tr_lang).val(0);
// Value is retrieved from HTML already generated server side
td.html(td.siblings('.hidden').children().clone()); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
}
}
);
}
);
}
;// ./vendor/wpsyntex/polylang/js/src/classic-editor.js
/**
* @package Polylang
*/
// tag suggest in metabox
jQuery(
function ( $ ) {
$.ajaxPrefilter(
function ( options, originalOptions, jqXHR ) {
var lang = $( '.post_lang_choice' ).val();
if ( 'string' === typeof options.data && -1 !== options.url.indexOf( 'action=ajax-tag-search' ) && lang ) {
options.data = 'lang=' + lang + '&' + options.data;
}
}
);
}
);
// overrides tagBox.get
jQuery(
function ( $ ) {
// overrides function to add the language
tagBox.get = function ( id ) {
var tax = id.substr( id.indexOf( '-' ) + 1 );
// add the language in the $_POST variable
var data = {
action: 'get-tagcloud',
lang: $( '.post_lang_choice' ).val(),
tax: tax
}
$.post(
ajaxurl,
data,
function ( r, stat ) {
if ( 0 == r || 'success' != stat ) {
r = wpAjax.broken;
}
// @see code from WordPress core https://github.com/WordPress/WordPress/blob/5.2.2/wp-admin/js/tags-box.js#L291
// @see wp_generate_tag_cloud function which generate the escaped HTML https://github.com/WordPress/WordPress/blob/a02b5cc2a8eecb8e076fbb7cf4de7bd2ec8a8eb1/wp-includes/category-template.php#L966-L975
r = $( '<div />' ).addClass( 'the-tagcloud' ).attr( 'id', 'tagcloud-' + tax ).html( r ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
$( 'a', r ).on(
'click',
function () {
tagBox.flushTags( $( this ).closest( '.inside' ).children( '.tagsdiv' ), this );
return false;
}
);
var tagCloud = $( '#tagcloud-' + tax );
// add an if else condition to allow modifying the tags outputted when switching the language
var v = tagCloud.css( 'display' );
if ( v ) {
// See the comment above when r variable is created.
$( '#tagcloud-' + tax ).replaceWith( r ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
$( '#tagcloud-' + tax ).css( 'display', v );
}
else {
// See the comment above when r variable is created.
$( '#' + id ).after( r ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after
}
}
);
}
}
);
jQuery(
function ( $ ) {
// collect taxonomies - code partly copied from WordPress
var taxonomies = new Array();
$( '.categorydiv' ).each(
function () {
var this_id = $( this ).attr( 'id' ), taxonomyParts, taxonomy;
taxonomyParts = this_id.split( '-' );
taxonomyParts.shift();
taxonomy = taxonomyParts.join( '-' );
taxonomies.push( taxonomy ); // store the taxonomy for future use
// add our hidden field in the new category form - for each hierarchical taxonomy
// to set the language when creating a new category
// html code inserted come from html code itself.
$( '#' + taxonomy + '-add-submit' ).before( // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.before
$( '<input />' ).attr( 'type', 'hidden' )
.attr( 'id', taxonomy + '-lang' )
.attr( 'name', 'term_lang_choice' )
.attr( 'value', $( '.post_lang_choice' ).val() )
);
}
);
// Initialize current language to be able to compare if it changes.
initializeLanguageOldValue();
// ajax for changing the post's language in the languages metabox
$( '.post_lang_choice' ).on(
'change',
function ( event ) {
// Initialize the confirmation dialog box.
const confirmationModal = initializeConfirmationModal();
const { dialogContainer: dialog } = confirmationModal;
let { dialogResult } = confirmationModal;
// The selected option in the dropdown list.
const selectedOption = event.target;
if ( $( this ).data( 'old-value' ) !== selectedOption.value && ! isEmptyPost() ) {
dialog.dialog( 'open' );
} else {
dialogResult = Promise.resolve();
}
dialogResult.then(
() => {
var data = {
action: 'post_lang_choice',
lang: selectedOption.value,
post_type: $( '#post_type' ).val(),
taxonomies: taxonomies,
post_id: $( '#post_ID' ).val(),
_pll_nonce: $( '#_pll_nonce' ).val()
}
$.post(
ajaxurl,
data,
function ( response ) {
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
switch ( this.what ) {
case 'translations': // translations fields
// Data is built and come from server side and is well escaped when necessary
$( '.translations' ).html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
initMetaboxAutoComplete();
break;
case 'taxonomy': // categories metabox for posts
var tax = this.data;
// @see wp_terms_checklist https://github.com/WordPress/WordPress/blob/5.2.2/wp-admin/includes/template.php#L175
// @see https://github.com/WordPress/WordPress/blob/5.2.2/wp-admin/includes/class-walker-category-checklist.php#L89-L111
$( '#' + tax + 'checklist' ).html( this.supplemental.all ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
// @see wp_popular_terms_checklist https://github.com/WordPress/WordPress/blob/5.2.2/wp-admin/includes/template.php#L236
$( '#' + tax + 'checklist-pop' ).html( this.supplemental.populars ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
// @see wp_dropdown_categories https://github.com/WordPress/WordPress/blob/5.5.1/wp-includes/category-template.php#L336
// which is called by PLL_Admin_Classic_Editor::post_lang_choice to generate supplemental.dropdown
$( '#new' + tax + '_parent' ).replaceWith( this.supplemental.dropdown ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
$( '#' + tax + '-lang' ).val( $( '.post_lang_choice' ).val() ); // hidden field
break;
case 'pages': // parent dropdown list for pages
// @see wp_dropdown_pages https://github.com/WordPress/WordPress/blob/5.2.2/wp-includes/post-template.php#L1186-L1208
// @see https://github.com/WordPress/WordPress/blob/5.2.2/wp-includes/class-walker-page-dropdown.php#L88
$( '#parent_id' ).html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
break;
case 'flag': // flag in front of the select dropdown
// Data is built and come from server side and is well escaped when necessary
$( '.pll-select-flag' ).html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
break;
case 'permalink': // Sample permalink
var div = $( '#edit-slug-box' );
if ( '-1' != this.data && div.children().length ) {
// @see get_sample_permalink_html https://github.com/WordPress/WordPress/blob/5.2.2/wp-admin/includes/post.php#L1425-L1454
div.html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
}
break;
}
}
);
// Creates an event once the language has been successfully changed.
const onPostLangChoice = new CustomEvent(
"onPostLangChoice",
{
detail: {
lang: JSON.parse( selectedOption.options[selectedOption.options.selectedIndex].getAttribute( 'data-lang' ) )
},
}
);
document.dispatchEvent( onPostLangChoice );
}
)
},
() => {} // Do nothing when promise is rejected by clicking the Cancel dialog button.
);
function isEmptyPost() {
const title = $( 'input#title' ).val();
const content = $( 'textarea#content' ).val();
const excerpt = $( 'textarea#excerpt' ).val();
return ! title && ! content && ! excerpt;
}
}
);
// Listen to `onPostLangChoice` to perform actions after the language has been changed.
document.addEventListener(
'onPostLangChoice',
( e ) => {
// Update the old language with the new one to be able to compare it in the next changing.
initializeLanguageOldValue();
// Modifies the language in the tag cloud.
$( '.tagcloud-link' ).each(
function () {
var id = $( this ).attr( 'id' );
tagBox.get( id );
}
);
// Modifies the text direction.
let dir = e.detail.lang.is_rtl ? 'rtl' : 'ltr'
$( 'body' ).removeClass( 'pll-dir-rtl' ).removeClass( 'pll-dir-ltr' ).addClass( 'pll-dir-' + dir );
$( '#content_ifr' ).contents().find( 'html' ).attr( 'lang', e.detail.lang.locale ).attr( 'dir', dir );
$( '#content_ifr' ).contents().find( 'body' ).attr( 'dir', dir );
// Refresh media libraries.
pll.media.resetAllAttachmentsCollections();
}
);
initMetaboxAutoComplete();
}
);
/**
* @since 3.0
*
* @namespace pll
*/
var pll = window.pll || {};
/**
* @since 3.0
*
* @namespace pll.media
*/
_.extend( pll, { media: {} } );
/**
* @since 3.0
*
* @alias pll.media
* @memberOf pll
* @namespace
*/
var media = _.extend(
pll.media, /** @lends pll.media.prototype */
{
/**
* TODO: Find a way to delete references to Attachments collections that are not used anywhere else.
*
* @type {wp.media.model.Attachments}
*/
attachmentsCollections : [],
/**
* Imitates { @see wp.media.query } but log all Attachments collections created.
*
* @param {Object} [props]
* @return {wp.media.model.Attachments}
*/
query: function ( props ) {
var attachments = pll.media.query.delegate( props );
pll.media.attachmentsCollections.push( attachments );
return attachments;
},
resetAllAttachmentsCollections: function () {
this.attachmentsCollections.forEach(
function ( attachmentsCollection ) {
/**
* First reset the { @see wp.media.model.Attachments } collection.
* Then, if it is mirroring a { @see wp.media.model.Query } collection,
* refresh this one too, so it will fetch new data from the server,
* and then the wp.media.model.Attachments collection will synchronize with the new data.
*/
attachmentsCollection.reset();
if (attachmentsCollection.mirroring) {
attachmentsCollection.mirroring._hasMore = true;
attachmentsCollection.mirroring.reset();
}
}
);
}
}
);
if ( 'undefined' !== typeof wp && 'undefined' !== typeof wp.media ) {
/**
* @since 3.0
*
* @memberOf pll.media
*/
media.query = _.extend(
media.query, /** @lends pll.media.query prototype */
{
/**
* @type Function References WordPress { @see wp.media.query } constructor
*/
delegate: wp.media.query
}
)
// Substitute WordPress media query shortcut with our decorated function.
wp.media.query = media.query
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,309 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 631
(module) {
module.exports = (function() { return this["wp"]["apiFetch"]; }());
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
var external_this_wp_apiFetch_ = __webpack_require__(631);
var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
;// ./src/integrations/ACF/js/lib/object.js
/**
* Gets the keys of existing relational ACF fields in the DOM (`relationship`, `post_object` and `taxonomy`).
*
* @return {[]} An array of relational fields.
*/
function getRelationalFieldKeys() {
const fields = [];
// Adds relationship, post object and taxonomy fields to the fields to be refreshed.
document.querySelectorAll('.acf-field-relationship, .acf-field-post-object, .acf-field-taxonomy').forEach(function (relationshipField) {
const field = relationshipField.getAttribute('data-key');
fields.push(field);
});
return fields;
}
/**
* Updates the ACF field with the content translated into the new language selected in the switcher.
*
* @param {Object} fieldData ACF field data fetched using AJAX (key and content).
*/
function reloadField(fieldData) {
// Data comes from ACF field and server side.
const field = document.querySelector('.acf-' + fieldData.field_key);
field.outerHTML = fieldData.field_data;
/**
* Triggers the action once the field has been refreshed,
* so that the actions hooked previously are re-launched on the newly refreshed field.
*/
acf.do_action('ready_field/type=' + field.getAttribute('data-type'), field);
}
/**
* Refreshes `relationship` relational fields.
* We need to reload the choices list for relationship fields (otherwise it remains empty).
*
* @param {Array} relationshipFields The `relationship` fields.
*/
function refreshRelationShipFields(relationshipFields) {
relationshipFields.forEach(function (field) {
field.fetch();
});
}
/**
* Gets the `post_object` and `relationship` relational fields.
* In addition, `acf.getFields` reloads the list of posts in `post_object` fields.
*
* @return {{postObject, relationShip}} `post_object` and `relationship` relational fields.
*/
function getRelationalFields() {
const relationshipFields = acf.getFields({
type: 'relationship'
});
// Reloads the posts list in `post_object` fields.
const postObjectFields = acf.getFields({
type: 'post_object'
});
return {
relationShip: relationshipFields,
postObject: postObjectFields
};
}
;// ./src/integrations/ACF/js/lib/post.js
/**
* WordPress dependencies.
*/
/**
* Internal dependencies
*/
/**
* Refreshes relational fields when switching languages on a post.
*
* @param {CustomEvent} e The event.
*/
function onPostLangChoice(e) {
const fieldKeys = getRelationalFieldKeys();
if (0 === fieldKeys.length) {
return;
}
const postId = document.getElementById('post_ID').getAttribute('value');
let nonce = document.querySelector('#_pll_nonce')?.value; // Classic editor.
if (undefined === nonce) {
// Block editor.
nonce = pll_block_editor_plugin_settings.nonce;
}
const data = new FormData();
data.set('action', 'acf_post_lang_choice');
data.set('lang', encodeURI(e.detail.lang.slug));
data.set('fields', fieldKeys);
data.set('post_id', postId);
data.set('_pll_nonce', nonce);
external_this_wp_apiFetch_default()({
url: ajaxurl,
method: 'POST',
body: data
}).then(response => {
response.fields.forEach(function (res) {
reloadField(res);
});
const fields = getRelationalFields();
refreshRelationShipFields(fields.relationShip);
});
}
;// ./src/integrations/ACF/js/lib/term.js
/**
* WordPress dependencies.
*/
/**
* Internal dependencies
*/
/**
* Returns the selected language slug.
*
* @return {string} The selected language slug.
*/
function getSelectedLanguageSlug() {
const selectLang = document.querySelector('#term_lang_choice');
return JSON.parse(selectLang.options.item(selectLang.selectedIndex).getAttribute('data-lang')).slug;
}
/**
* Refreshes relational fields according to the selected language in the term creation page.
*/
function onTermCreationPageLoad() {
/* global adminpage */
if ('edit-tags-php' === adminpage) {
/**
* When we're on a term creation page, we don't have a current language, so relational fields are loaded in all languages.
* We need to add the language slug fetched from the language selector to the AJAX request
* to load the relational field with the correct current language.
*/
acf.addFilter('relationship_ajax_data', function (param) {
param.lang = getSelectedLanguageSlug();
return param;
});
acf.addFilter('select2_ajax_data', function (param) {
// Post object.
param.lang = getSelectedLanguageSlug();
return param;
});
}
}
/**
* Refreshes relational fields when switching languages on a term.
*
* @param {CustomEvent} e The event.
*/
function onTermLangChoice(e) {
const fieldKeys = getRelationalFieldKeys();
if (0 === fieldKeys.length) {
return;
}
const termID = document.querySelector("input[name='tag_ID']") ? document.querySelector("input[name='tag_ID']").value : '0';
let nonce = document.querySelector('#_pll_nonce')?.value; // Classic editor.
if (undefined === nonce) {
// Block editor.
nonce = pll_block_editor_plugin_settings.nonce;
}
const taxonomy = new URLSearchParams(wp.sanitize.stripTags(window.location.search) // phpcs:ignore WordPressVIPMinimum.JS.Window.location
).get('taxonomy');
const data = new FormData();
data.set('action', 'acf_term_lang_choice');
data.set('lang', encodeURI(e.detail.lang.slug));
data.set('fields', fieldKeys);
data.set('term_id', termID);
data.set('_pll_nonce', nonce);
data.set('taxonomy', taxonomy);
external_this_wp_apiFetch_default()({
url: ajaxurl,
method: 'POST',
body: data
}).then(response => {
response.fields.forEach(function (res) {
reloadField(res);
});
const fields = getRelationalFields();
if (fields.relationShip) {
/**
* Since the language is not saved when switching languages on a term, we need to add this `lang` parameter
* to the AJAX request to load the relational field with the correct current language.
*/
acf.addFilter('relationship_ajax_data', function (param) {
param.lang = response.lang;
return param;
});
}
if (fields.postObject) {
/**
* Since the language is not saved when switching languages on a term, we need to add this `lang` parameter
* to the AJAX request to load the relational field with the correct current language.
*/
acf.addFilter('select2_ajax_data', function (param) {
param.lang = response.lang;
return param;
});
}
refreshRelationShipFields(fields.relationShip);
});
}
;// ./src/integrations/ACF/js/index.js
/**
* Internal dependencies.
*/
/**
* Posts.
*/
document.addEventListener('onPostLangChoice', onPostLangChoice);
/**
* Terms.
*/
document.addEventListener('DOMContentLoaded', onTermCreationPageLoad);
document.addEventListener('onTermLangChoice', onTermLangChoice);
})();
this["polylang-pro"] = __webpack_exports__;
/******/ })()
;
@@ -0,0 +1 @@
(()=>{var t={631(t){t.exports=function(){return this.wp.apiFetch}()}},e={};function n(o){var a=e[o];if(void 0!==a)return a.exports;var r=e[o]={exports:{}};return t[o](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);(()=>{"use strict";var t=n(631),e=n.n(t);function o(){const t=[];return document.querySelectorAll(".acf-field-relationship, .acf-field-post-object, .acf-field-taxonomy").forEach((function(e){const n=e.getAttribute("data-key");t.push(n)})),t}function a(t){const e=document.querySelector(".acf-"+t.field_key);e.outerHTML=t.field_data,acf.do_action("ready_field/type="+e.getAttribute("data-type"),e)}function r(t){t.forEach((function(t){t.fetch()}))}function c(){return{relationShip:acf.getFields({type:"relationship"}),postObject:acf.getFields({type:"post_object"})}}function i(){const t=document.querySelector("#term_lang_choice");return JSON.parse(t.options.item(t.selectedIndex).getAttribute("data-lang")).slug}document.addEventListener("onPostLangChoice",(function(t){const n=o();if(0===n.length)return;const i=document.getElementById("post_ID").getAttribute("value");let l=document.querySelector("#_pll_nonce")?.value;void 0===l&&(l=pll_block_editor_plugin_settings.nonce);const d=new FormData;d.set("action","acf_post_lang_choice"),d.set("lang",encodeURI(t.detail.lang.slug)),d.set("fields",n),d.set("post_id",i),d.set("_pll_nonce",l),e()({url:ajaxurl,method:"POST",body:d}).then((t=>{t.fields.forEach((function(t){a(t)}));r(c().relationShip)}))})),document.addEventListener("DOMContentLoaded",(function(){"edit-tags-php"===adminpage&&(acf.addFilter("relationship_ajax_data",(function(t){return t.lang=i(),t})),acf.addFilter("select2_ajax_data",(function(t){return t.lang=i(),t})))})),document.addEventListener("onTermLangChoice",(function(t){const n=o();if(0===n.length)return;const i=document.querySelector("input[name='tag_ID']")?document.querySelector("input[name='tag_ID']").value:"0";let l=document.querySelector("#_pll_nonce")?.value;void 0===l&&(l=pll_block_editor_plugin_settings.nonce);const d=new URLSearchParams(wp.sanitize.stripTags(window.location.search)).get("taxonomy"),u=new FormData;u.set("action","acf_term_lang_choice"),u.set("lang",encodeURI(t.detail.lang.slug)),u.set("fields",n),u.set("term_id",i),u.set("_pll_nonce",l),u.set("taxonomy",d),e()({url:ajaxurl,method:"POST",body:u}).then((t=>{t.fields.forEach((function(t){a(t)}));const e=c();e.relationShip&&acf.addFilter("relationship_ajax_data",(function(e){return e.lang=t.lang,e})),e.postObject&&acf.addFilter("select2_ajax_data",(function(e){return e.lang=t.lang,e})),r(e.relationShip)}))}))})(),this["polylang-pro"]={}})();
@@ -0,0 +1,303 @@
/**
* @package Polylang
*/
jQuery(
function ( $ ) {
var addLanguageForm = $( '.languages-step' ); // Form element.
var languageFields = $( '#language-fields' ); // Element where to append hidden fields for creating language.
var languagesTable = $( '#languages' ); // Table element contains languages list to create.
var languagesListTable = $( '#languages tbody' ); // Table rows with languages list to create.
var definedLanguagesListTable = $( '#defined-languages tbody' ); // Table rows with already defined languages list.
var languagesList = $( '#lang_list' ); // Select form element with predefined languages without already created languages.
var nextStepButton = $( '[name="save_step"]' ); // The button for continuing to the next step.
var messagesContainer = $( '#messages' ); // Element where to display error messages.
var languagesMap = new Map(); // Languages map object for managing the languages to create.
var dialog = $( '#dialog' ); // Dialog box for alerting the language selected has not been added to the list.
/**
* Add a language in the list to create it in Polylang settings
*
* @param {object} language The language object
*/
function addLanguage( language ) {
// language properties come from the select dropdown which is built server side and well escaped.
// see template view-wizard-step-languages.php.
var languageValueHtml = $( '<td />' ).text( language.text ).prepend( language.flagUrl ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
var languageTrashIconHtml = $( '<td />' )
.append( // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
$( '<span />' )
.addClass( 'dashicons dashicons-trash' )
.attr( 'data-language', language.locale )
.append( // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
$( '<span />' )
.addClass( 'screen-reader-text' )
.text( pll_wizard_params.i18n_remove_language_icon )
)
);
// see the comment and the hardcoded code above. languageTrashIconHtml and languageValueHtml are safe.
var languageLineHtml = $( '<tr />' ).prepend( languageTrashIconHtml ).prepend( languageValueHtml ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
var languageFieldHtml = $( '<input />' ).attr(
{
type: 'hidden',
name: 'languages[]'
}
).val( language.locale );
languagesList.val( '' );
languagesList.selectmenu( 'refresh' ); // Refresh jQuery selectmenu widget after changing the value.
languagesMap.set( language.locale, language );
// see above how languageLineHtml is built.
languagesListTable.append( languageLineHtml ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
// Bind click event on trash icon.
languagesListTable.on(
'click',
'span[data-language=' + language.locale + ']',
function ( event ) {
event.preventDefault();
// Remove line in languages table.
$( this ).parents( 'tr' ).remove();
// Remove input field.
var languageField = languageFields.children( 'input[value=' + $( this ).data( 'language' ) + ']' ).remove();
// If there is no more languages hide languages table.
if ( languagesListTable.children().length <= 0 ) {
languagesTable.hide();
}
// Remove language from the Map.
languagesMap.delete( $( this ).data( 'language' ) );
// Hide error message.
hideError();
}
);
// see above how languageFieldHtml is built.
// Add hidden input field for posting the form.
languageFields.append( languageFieldHtml ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
}
/**
* Display an error message
*
* @param {string} message The message to display
*/
function showError( message ) {
messagesContainer.empty();
// html is hardcoded and use of jQuery text method which is safe to add message value.
// In addition message is i18n value which is initialized server side in PLL_Wizard::add_step_languages and correctly escaped.
messagesContainer.prepend( $( '<p/>' ).addClass( 'error' ).text( message ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
}
/**
* Hide all error messages and fields in error
*/
function hideError() {
messagesContainer.empty();
addLanguageForm.find( '.error' ).removeClass( 'error field-in-error' );
}
/**
* Style the field to indicate where the error is
*
* @param {object} field The jQuery element which is in error
*/
function showFieldInError( field ) {
field.addClass( 'error field-in-error' );
}
/**
* Focus on a specific element
*
* @param {object} field The jQuery element which will be focused
*/
function focusOnField( field ) {
field.trigger( 'focus' );
}
/**
* Disable a specific button
*
* @param {object} button
*/
function disableButton( button ){
button.prop( 'disabled', true );
// Because the button is disabled we need to add the value of the button to ensure it will pass in the request.
addLanguageForm.append( // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
$( '<input />' ).prop(
{
type: 'hidden',
name: button.prop( 'name' ),
value: button.prop( 'value' )
}
)
);
}
/**
* Remove error when a new selection is done in languages list.
*/
languagesList.on(
'selectmenuchange',
function () {
hideError();;
}
);
/**
* Bind click event on "Add language" button
*/
$( '#add-language' ).on(
'click',
function ( event ) {
hideError();
var selectedOption = event.currentTarget.form.lang_list.options[event.currentTarget.form.lang_list.selectedIndex];
if ( '' !== selectedOption.value && ! languagesMap.has( selectedOption.value ) ) {
addLanguage(
{
locale: selectedOption.value,
text: selectedOption.innerText,
name: $( selectedOption ).data( 'language-name' ),
flagUrl: $( selectedOption ).data( 'flag-html' )
}
);
// Show table of languages.
languagesTable.show();
// Put back the focus on the select language field after clicking on "Add language button".
focusOnField( $( '#lang_list-button' ) );
} else {
var message = pll_wizard_params.i18n_no_language_selected;
if ( languagesMap.has( selectedOption.value ) ) {
message = pll_wizard_params.i18n_language_already_added;
}
showError( message );
showFieldInError( languagesList.next( 'span.ui-selectmenu-button' ) );
focusOnField( $( '#lang_list-button' ) );
}
}
);
/**
* Bind submit event on "add_lang" form
*/
addLanguageForm.on(
'submit',
function ( event ) {
// Verify if there is at least one language.
var isLanguagesAlreadyDefined = definedLanguagesListTable.children().length > 0;
var selectedLanguage = $( '#lang_list' ).val();
if ( languagesMap.size <= 0 && ! isLanguagesAlreadyDefined ) {
if ( '' === selectedLanguage ) {
showError( pll_wizard_params.i18n_no_language_added );
showFieldInError( languagesList.next( 'span.ui-selectmenu-button' ) );
focusOnField( $( '#lang_list-button' ) );
} else {
showError( pll_wizard_params.i18n_add_language_needed );
showFieldInError( languagesList.next( 'span.ui-selectmenu-button' ) );
focusOnField( $( '#add-language' ) ); // Put the focus on the "Add language" button.
}
return false;
}
// Verify if the language has been added in the list otherwise display a dialog box to confirm what to do.
if ( '' !== selectedLanguage ) {
// Verify we don't add a duplicate language before opening the dialog box otherwise display an error message.
if ( ! languagesMap.has( selectedLanguage ) ) {
dialog.dialog( 'open' );
} else {
showError( pll_wizard_params.i18n_language_already_added );
showFieldInError( languagesList.next( 'span.ui-selectmenu-button' ) );
focusOnField( $( '#lang_list-button' ) );
}
return false;
}
disableButton( nextStepButton );
}
);
// Is there an error return by PHP ?
var searchParams = new URLSearchParams( document.location.search );
if ( searchParams.has( 'activate_error' ) ) {
// If the error code exists, display it.
if ( undefined !== pll_wizard_params[ searchParams.get( 'activate_error' ) ] ) {
showError( pll_wizard_params[ searchParams.get( 'activate_error' ) ] );
}
}
function confirmDialog( what ) {
switch ( what ) {
case 'yes':
var selectedOption = $( '#lang_list' ).children( ':selected' );
addLanguage(
{
locale: selectedOption[0].value,
text: selectedOption[0].innerText,
name: $( selectedOption ).data( 'language-name' ),
flagUrl: $( selectedOption ).data( 'flag-html' )
}
);
break;
case 'no':
// Empty select form field and submit again the form.
languagesList.val( '' );
break;
case 'ignore':
}
dialog.dialog( 'close' );
if ( 'ignore' === what ) {
focusOnField( $( '#lang_list-button' ) );
} else {
addLanguageForm.submit();
}
}
// Initialize dialog box in the case a language is selected but not added in the list.
dialog.dialog(
{
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
title: pll_wizard_params.i18n_dialog_title,
minWidth: 600,
maxWidth: '100%',
open: function ( event, ui ) {
// Change dialog box position for rtl language
if ( $( 'body' ).hasClass( 'rtl' ) ) {
$( this ).parent().css(
{
right: $( this ).parent().css( 'left' ),
left: 'auto'
}
);
}
// Display language name and flag information in dialog box.
$( this ).find( '#dialog-language' ).text( $( '#lang_list' ).children( ':selected' ).first().text() );
// language properties come from the select dropdown #lang_list which is built server side and well escaped.
// see template view-wizard-step-languages.php.
$( this ).find( '#dialog-language-flag' ).empty().prepend( $( '#lang_list' ).children( ':selected' ).data( 'flag-html' ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
},
buttons: [
{
text: pll_wizard_params.i18n_dialog_yes_button,
click: function ( event ) {
confirmDialog( 'yes' );
}
},
{
text: pll_wizard_params.i18n_dialog_no_button,
click: function ( event ) {
confirmDialog( 'no' );
}
},
{
text: pll_wizard_params.i18n_dialog_ignore_button,
click: function ( event ) {
confirmDialog( 'ignore' );
}
}
]
}
)
}
);
@@ -0,0 +1 @@
jQuery((function(a){var e=a(".languages-step"),n=a("#language-fields"),t=a("#languages"),l=a("#languages tbody"),i=a("#defined-languages tbody"),r=a("#lang_list"),d=a('[name="save_step"]'),s=a("#messages"),o=new Map,g=a("#dialog");function u(e){var i=a("<td />").text(e.text).prepend(e.flagUrl),d=a("<td />").append(a("<span />").addClass("dashicons dashicons-trash").attr("data-language",e.locale).append(a("<span />").addClass("screen-reader-text").text(pll_wizard_params.i18n_remove_language_icon))),s=a("<tr />").prepend(d).prepend(i),g=a("<input />").attr({type:"hidden",name:"languages[]"}).val(e.locale);r.val(""),r.selectmenu("refresh"),o.set(e.locale,e),l.append(s),l.on("click","span[data-language="+e.locale+"]",(function(e){e.preventDefault(),a(this).parents("tr").remove();n.children("input[value="+a(this).data("language")+"]").remove();l.children().length<=0&&t.hide(),o.delete(a(this).data("language")),c()})),n.append(g)}function p(e){s.empty(),s.prepend(a("<p/>").addClass("error").text(e))}function c(){s.empty(),e.find(".error").removeClass("error field-in-error")}function _(a){a.addClass("error field-in-error")}function m(a){a.trigger("focus")}r.on("selectmenuchange",(function(){c()})),a("#add-language").on("click",(function(e){c();var n=e.currentTarget.form.lang_list.options[e.currentTarget.form.lang_list.selectedIndex];if(""===n.value||o.has(n.value)){var l=pll_wizard_params.i18n_no_language_selected;o.has(n.value)&&(l=pll_wizard_params.i18n_language_already_added),p(l),_(r.next("span.ui-selectmenu-button")),m(a("#lang_list-button"))}else u({locale:n.value,text:n.innerText,name:a(n).data("language-name"),flagUrl:a(n).data("flag-html")}),t.show(),m(a("#lang_list-button"))})),e.on("submit",(function(n){var t,l=i.children().length>0,s=a("#lang_list").val();return o.size<=0&&!l?(""===s?(p(pll_wizard_params.i18n_no_language_added),_(r.next("span.ui-selectmenu-button")),m(a("#lang_list-button"))):(p(pll_wizard_params.i18n_add_language_needed),_(r.next("span.ui-selectmenu-button")),m(a("#add-language"))),!1):""!==s?(o.has(s)?(p(pll_wizard_params.i18n_language_already_added),_(r.next("span.ui-selectmenu-button")),m(a("#lang_list-button"))):g.dialog("open"),!1):((t=d).prop("disabled",!0),void e.append(a("<input />").prop({type:"hidden",name:t.prop("name"),value:t.prop("value")})))}));var f=new URLSearchParams(document.location.search);function h(n){switch(n){case"yes":var t=a("#lang_list").children(":selected");u({locale:t[0].value,text:t[0].innerText,name:a(t).data("language-name"),flagUrl:a(t).data("flag-html")});break;case"no":r.val("")}g.dialog("close"),"ignore"===n?m(a("#lang_list-button")):e.submit()}f.has("activate_error")&&void 0!==pll_wizard_params[f.get("activate_error")]&&p(pll_wizard_params[f.get("activate_error")]),g.dialog({autoOpen:!1,modal:!0,draggable:!1,resizable:!1,title:pll_wizard_params.i18n_dialog_title,minWidth:600,maxWidth:"100%",open:function(e,n){a("body").hasClass("rtl")&&a(this).parent().css({right:a(this).parent().css("left"),left:"auto"}),a(this).find("#dialog-language").text(a("#lang_list").children(":selected").first().text()),a(this).find("#dialog-language-flag").empty().prepend(a("#lang_list").children(":selected").data("flag-html"))},buttons:[{text:pll_wizard_params.i18n_dialog_yes_button,click:function(a){h("yes")}},{text:pll_wizard_params.i18n_dialog_no_button,click:function(a){h("no")}},{text:pll_wizard_params.i18n_dialog_ignore_button,click:function(a){h("ignore")}}]})}));
@@ -0,0 +1,436 @@
/**
* @package Polylang-Pro
*/
const { addAction } = wp.hooks;
const pllMachineTranslation = {
/**
* Init.
*/
init: () => {
if ( document.readyState !== 'loading' ) {
pllMachineTranslation.ajaxButton.attachEvent();
pllMachineTranslation.dataUsage.fetchData();
pllMachineTranslation.glossaries.init();
} else {
document.addEventListener( 'DOMContentLoaded', pllMachineTranslation.ajaxButton.attachEvent );
document.addEventListener( 'DOMContentLoaded', pllMachineTranslation.dataUsage.fetchData );
document.addEventListener( 'DOMContentLoaded', pllMachineTranslation.glossaries.init );
}
addAction( 'pll_settings_saved', 'polylang-pro', pllMachineTranslation.saveSettings.highlightRow );
addAction( 'pll_settings_saved', 'polylang-pro', pllMachineTranslation.dataUsage.fetchData );
addAction( 'pll_settings_saved', 'polylang-pro', pllMachineTranslation.glossaries.fetchDataOnSave );
},
/**
* Resets a field's row.
*
* @param {HTMLElement} fieldRow Field's row.
*/
resetFieldRow: ( fieldRow ) => {
fieldRow.querySelectorAll( '.pll-message-shown' ).forEach( ( el ) => {
el.classList.remove( 'pll-message-shown' );
} );
fieldRow.classList.remove( 'notice-success', 'notice-warning', 'notice-error', 'notice-alt' );
fieldRow.querySelectorAll( '.pll-error-message-text' ).forEach( ( el ) => {
el.textContent = '';
} );
},
/**
* Displays an error message under the field by adding HTML classes.
*
* @param {HTMLElement} fieldRow Field's row.
* @param {String} messageClass HTML class of the error message to display.
* @param {String} type Type of the error: `'error'` or `'warning'`.
*/
displayErrorMessage: ( fieldRow, messageClass, type = 'error' ) => {
if ( messageClass ) {
fieldRow.querySelectorAll( '.' + messageClass ).forEach( ( el ) => {
el.classList.add( 'pll-message-shown' );
} );
}
fieldRow.classList.add( 'notice-' + type, 'notice-alt' );
},
ajaxButton: {
/**
* Attaches an event to `.pll-ajax-button` buttons to trigger AJAX requests.
*/
attachEvent: () => {
document.querySelectorAll( '.pll-ajax-button' ).forEach( ( el ) => {
el.addEventListener( 'click', ( event ) => {
const button = event.target;
const action = button.getAttribute( 'data-action' );
const nonce = button.getAttribute( 'data-nonce' );
const fieldRow = button.closest( 'tr' );
const errorElms = fieldRow.querySelectorAll( '.pll-error-message-text' );
if ( ! action || ! nonce || ! fieldRow || ! errorElms.length || button.getAttribute( 'disabled' ) ) {
return;
}
const urlParams = { 'action': action, '_pll_nonce': nonce, 'pll_ajax_settings': 1 };
fieldRow.querySelectorAll( '[data-name]' ).forEach( ( el ) => {
urlParams[ el.getAttribute( 'data-name' ) ] = el.value;
} );
const url = wp.url.addQueryArgs( ajaxurl, urlParams );
button.setAttribute( 'disabled', 'disabled' );
pllMachineTranslation.resetFieldRow( fieldRow );
fetch( url ).then( ( response ) => {
return response.json();
} ).then( ( json ) => {
button.removeAttribute( 'disabled' );
if ( json.success ) {
fieldRow.classList.add( 'notice-success', 'notice-alt' );
} else {
errorElms[0].textContent = json.data && json.data.message ? json.data.message : '';
pllMachineTranslation.displayErrorMessage( fieldRow, json.data ? json.data.message_class : '' );
}
} ).catch( () => {
button.removeAttribute( 'disabled' );
fieldRow.classList.add( 'notice-error', 'notice-alt' );
} );
} );
} );
}
},
saveSettings: {
/**
* Highlights a settings row in case of error when the settings are saved.
* Hooked to `'pll_settings_saved'`.
*
* @param {Object} response The response from the AJAX call.
* @param {HTMLElement} tr The HTML element containing the module's fields.
*/
highlightRow: ( response, tr ) => {
switch ( response.what ) {
case 'success':
tr.querySelectorAll( '.notice-alt, .pll-message-shown' ).forEach( ( el ) => {
el.classList.remove( 'notice-success', 'notice-warning', 'notice-error', 'notice-alt', 'pll-message-shown' );
} );
break;
case 'error':
const noticeData = pllMachineTranslation.saveSettings.getNoticeData( response.data );
if ( ! noticeData.fieldId ) {
break;
}
const field = document.getElementById( noticeData.fieldId );
if ( ! field ) {
break;
}
const fieldRow = field.closest( 'tr' );
if ( ! fieldRow ) {
break;
}
pllMachineTranslation.resetFieldRow( fieldRow );
pllMachineTranslation.displayErrorMessage( fieldRow, noticeData.messageClass, noticeData.type );
break;
}
},
/**
* Returns the data contained in the HTML classes of the given element.
*
* @param {String} htmlString HTML string.
* @returns {Object}
*/
getNoticeData: ( htmlString ) => {
const div = document.createElement( 'div' );
div.innerHTML = htmlString.trim(); // phpcs:ignore WordPressVIPMinimum.JS.InnerHTML.Found
return {
type: pllMachineTranslation.saveSettings.find( div.firstChild.className, 'notice-(success|warning|error)', 'error' ),
fieldId: pllMachineTranslation.saveSettings.find( div.firstChild.className, 'pll-field-id-([^\\s]+)', '' ), // See `Settings\Deepl::is_api_key_valid()` and `Module_Settings::update()`.
messageClass: pllMachineTranslation.saveSettings.find( div.firstChild.className, 'pll-message-class-([^\\s]+)', '' ) // See `Settings\Deepl::is_api_key_valid()` and `Module_Settings::update()`.
};
},
/**
* Returns the part of the given string matching the given pattern.
*
* @param {String} string A string.
* @param {String} pattern A regex pattern.
* @param {String} def String to return if nothing is found.
* @returns {String}
*/
find: ( string, pattern, def ) => {
const matches = ( ' ' + string + ' ' ).match( new RegExp( '\\s' + pattern + '\\s' ) );
return matches && matches[1] ? matches[1] : def;
}
},
dataUsage: {
fetchData: () => {
document
.querySelectorAll( '.pll-progress-bar-wrapper' )
.forEach( ( el ) => {
const action = el.getAttribute( 'data-action' );
const nonce = el.getAttribute( 'data-nonce' );
const progress = el.querySelectorAll( 'div' ).item( 0 );
const dataUsageRow = el.closest( 'tr' );
if (
! action ||
! nonce ||
! progress ||
! dataUsageRow ||
! el.parentElement
) {
return;
}
const description = el.parentElement
.querySelectorAll( '.description' )
.item( 0 );
if ( ! description ) {
return;
}
// Reset the progress bar.
progress.style.width = '0%';
progress.textContent = '';
let spinner = el.querySelectorAll( '.spinner' ).item( 0 );
// If the spinner no longer exists (replaced by text), recreate it.
if ( ! spinner ) {
spinner = document.createElement( 'span' );
spinner.className = 'spinner pll-spinner-inline';
// Delete the existing text (percentage) and add the spinner.
el.innerHTML = '';
el.appendChild( spinner );
el.appendChild( progress );
} else {
// Display the spinner while loading.
spinner.style.visibility = 'visible';
}
const apiKey = document
.getElementById( 'pll-deepl-api-key' )
.value.trim();
if ( '' === apiKey ) {
// Do not display the row and do not make the AJAX call if the API key is empty.
dataUsageRow.style.display = 'none';
return;
}
// Show the data usage row and the progress bar (in case it was hidden before).
el.style.display = '';
dataUsageRow.style.display = '';
const urlParams = {
action,
_pll_nonce: nonce,
pll_ajax_settings: 1,
};
const url = wp.url.addQueryArgs( ajaxurl, urlParams );
fetch( url )
.then( ( response ) => {
return response.json();
} )
.then( ( json ) => {
if ( ! json.success || ! json.data.percent ) {
// No data - show the message but keep the row visible.
el.style.display = 'none';
description.textContent = json.data.message;
return;
}
// Display a graphic.
el.replaceChild(
document.createTextNode(
json.data.percent_formatted
),
spinner
);
progress.textContent = json.data.percent_formatted;
progress.style.width = json.data.percent;
description.textContent = json.data.message;
} )
.catch( () => {
dataUsageRow.remove();
} );
} );
},
},
glossaries: {
/**
* Init.
*/
init: () => {
const elems = pllMachineTranslation.glossaries.getElements();
if ( ! elems.action ) {
// Should not happen.
return;
}
// On page load, refresh the `<select>` tag.
pllMachineTranslation.glossaries.fetchData( elems );
// On API key input blur, refresh the `<select>` tag.
elems.apiKeyInput.addEventListener( 'blur', () => {
const newApiKey = elems.apiKeyInput.value.trim();
if ( newApiKey === elems.apiKey ) {
// The API key hasn't changed.
return;
}
elems.apiKey = newApiKey;
elems.hasNewApiKey = true;
pllMachineTranslation.glossaries.fetchData( elems );
} );
},
/**
* Refreshes the `<select>` tag on option save.
* Hooked to `'pll_settings_saved'`.
*/
fetchDataOnSave: () => {
const elems = pllMachineTranslation.glossaries.getElements();
if ( ! elems.action ) {
// Should not happen.
return;
}
pllMachineTranslation.glossaries.fetchData( elems );
},
/**
* Returns data from the form.
*
* @return {Object} {
* An object containing data from the form. The object can be empty on failure.
*
* @type {HTMLElement} glossaryInput The glossary selector.
* @type {string} action The AJAX action.
* @type {string} nonce The nonce for the AJAX request.
* @type {HTMLElement} apiKeyInput The API key input.
* @type {string} apiKey The API key.
* }
*/
getElements: () => {
const glossaryInput =
document.getElementById( 'pll-deepl-glossary' );
if ( ! glossaryInput ) {
return {};
}
const action = glossaryInput.getAttribute( 'data-action' );
const nonce = glossaryInput.getAttribute( 'data-nonce' );
if ( ! action || ! nonce ) {
return {};
}
const apiKeyInput = document.getElementById( 'pll-deepl-api-key' );
if ( ! apiKeyInput ) {
pllMachineTranslation.glossaries.removeOptions( glossaryInput );
return {};
}
const apiKey = apiKeyInput.value.trim();
return { glossaryInput, action, nonce, apiKeyInput, apiKey };
},
/**
* Refreshes the `<select>` tag.
*
* @param {Object} elems An object containing data from the form.
* @param {HTMLElement} elems.glossaryInput The glossary selector.
* @param {string} elems.action The AJAX action.
* @param {string} elems.nonce The nonce for the AJAX request.
* @param {HTMLElement} elems.apiKeyInput The API key input.
* @param {string} elems.apiKey The API key.
* @param {boolean} [elems.hasNewApiKey=false] Optional. Tells if the given API key must be sent in the AJAX request. Default is `false`.
*/
fetchData: ( elems ) => {
if ( elems.hasNewApiKey && '' === elems.apiKey ) {
// No need to request the API.
pllMachineTranslation.glossaries.removeOptions(
elems.glossaryInput
);
return;
}
elems.glossaryInput.setAttribute( 'disabled', 'disabled' );
const urlParams = {
action: elems.action,
_pll_nonce: elems.nonce,
pll_ajax_settings: 1,
};
if ( elems.hasNewApiKey ) {
urlParams.api_key = elems.apiKey;
}
const url = wp.url.addQueryArgs( ajaxurl, urlParams );
fetch( url )
.then( ( response ) => {
return response.json();
} )
.then( ( json ) => {
// First, empty the selector.
pllMachineTranslation.glossaries.removeOptions(
elems.glossaryInput
);
if ( ! json.success || ! json.data.glossaries ) {
// `json.success` being `false` may mean the API key is invalid.
elems.glossaryInput.removeAttribute( 'disabled' );
return;
}
// Insert new choices.
Object.entries( json.data.glossaries ).forEach(
( [ key, value ] ) => {
const opt = document.createElement( 'option' );
opt.value = key;
opt.textContent = value;
if ( key === json.data.selected ) {
opt.selected = true;
}
elems.glossaryInput.appendChild( opt );
}
);
elems.glossaryInput.removeAttribute( 'disabled' );
} )
.catch( () => {
elems.glossaryInput.removeAttribute( 'disabled' );
} );
},
/**
* Removes the `<option>` tags in the given `<select>` element, except the one with an empty value.
*
* @param {HTMLElement} select The parent element.
*/
removeOptions: ( select ) => {
Object.entries( select.children ).forEach( ( [ , option ] ) => {
if ( option.value.trim() !== '' ) {
option.remove();
}
} );
},
},
};
pllMachineTranslation.init();
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
/**
* @package Polylang
*/
/**
* Media list table
* When clicking on attach link, filters find post list per media language
*/
jQuery(
function ( $ ) {
$.ajaxPrefilter(
function ( options, originalOptions, jqXHR ) {
if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=find_posts' ) ) {
options.data = 'pll_post_id=' + $( '#affected' ).val() + '&' + options.data;
}
}
);
}
);
+1
View File
@@ -0,0 +1 @@
jQuery((function(a){a.ajaxPrefilter((function(t,d,f){"string"==typeof t.data&&-1!==t.data.indexOf("action=find_posts")&&(t.data="pll_post_id="+a("#affected").val()+"&"+t.data)}))}));
@@ -0,0 +1,46 @@
/**
* Handle the response to a click on a Languages metabox button.
*
* @package Polylang-Pro
*/
jQuery(
function ( $ ) {
$( '#ml_box' ).on(
'click',
'.pll-button',
function () {
var value = $( this ).hasClass( 'wp-ui-text-highlight' );
var id = $( this ).attr( 'id' );
var post_id = $( '#htr_lang_' + id.replace( 'pll_sync_post[', '' ).replace( ']', '' ) ).val();
if ( 'undefined' == typeof( post_id ) || 0 == post_id || value || confirm( pll_sync_post.confirm_text ) ) {
var data = {
action: 'toggle_' + id,
value: value,
post_type: $( '#post_type' ).val(),
_pll_nonce: $( '#_pll_nonce' ).val()
}
$.post(
ajaxurl,
data,
function ( response ) {
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
id = id.replace( '[', '\\[' ).replace( ']', '\\]' );
$( '#' + id ).toggleClass( 'wp-ui-text-highlight' ).attr( 'title', this.data ).children( 'span' ).text( this.data );
$( 'input[name="' + id + '"]' ).val( ! data['value'] );
}
);
}
);
}
}
);
}
);
@@ -0,0 +1 @@
jQuery((function(t){t("#ml_box").on("click",".pll-button",(function(){var a=t(this).hasClass("wp-ui-text-highlight"),l=t(this).attr("id"),e=t("#htr_lang_"+l.replace("pll_sync_post[","").replace("]","")).val();if(void 0===e||0==e||a||confirm(pll_sync_post.confirm_text)){var n={action:"toggle_"+l,value:a,post_type:t("#post_type").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,n,(function(a){var e=wpAjax.parseAjaxResponse(a,"pll-ajax-response");t.each(e.responses,(function(){l=l.replace("[","\\[").replace("]","\\]"),t("#"+l).toggleClass("wp-ui-text-highlight").attr("title",this.data).children("span").text(this.data),t('input[name="'+l+'"]').val(!n.value)}))}))}}))}));
@@ -0,0 +1,220 @@
/**
* Handles the options in the language switcher nav menu metabox.
*
* @package Polylang
*/
const pllNavMenu = {
/**
* The element wrapping the menu elements.
*
* @member {HTMLElement|null}
*/
wrapper: null,
/**
* Init.
*/
init: () => {
if ( document.readyState !== 'loading' ) {
pllNavMenu.ready();
} else {
document.addEventListener( 'DOMContentLoaded', pllNavMenu.ready );
}
},
/**
* Called when the DOM is ready. Attaches the events to the wrapper.
*/
ready: () => {
pllNavMenu.wrapper = document.getElementById( 'menu-to-edit' );
if ( ! pllNavMenu.wrapper ) {
return;
}
pllNavMenu.wrapper.addEventListener( 'click', pllNavMenu.printMetabox );
pllNavMenu.wrapper.addEventListener( 'change', pllNavMenu.ensureContent );
pllNavMenu.wrapper.addEventListener( 'change', pllNavMenu.showHideRows );
},
printMetabox: {
/**
* Event callback that prints our checkboxes in the language switcher.
*
* @param {Event} event The event.
*/
handleEvent: ( event ) => {
if ( ! event.target.classList.contains( 'item-edit' ) ) {
// Not clicking on a Edit arrow button.
return;
}
const metabox = event.target.closest( '.menu-item' ).querySelector( '.menu-item-settings' );
if ( ! metabox?.id ) {
// Should not happen.
return;
}
if ( ! metabox.querySelectorAll( 'input[value="#pll_switcher"][type=text]' ).length ) {
// Not our metabox, or already replaced.
return;
}
// Remove default fields we don't need.
[ ...metabox.children ].forEach( ( el ) => {
if ( 'P' === el.nodeName && ! el.classList.contains( 'field-move' ) ) {
el.remove();
}
} );
const t = pllNavMenu.printMetabox;
const itemId = Number( metabox.id.replace( 'menu-item-settings-', '' ) );
metabox.append( t.createHiddenInput( 'title', itemId, pll_data.title ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
metabox.append( t.createHiddenInput( 'url', itemId, '#pll_switcher' ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
metabox.append( t.createHiddenInput( 'pll-detect', itemId, 1 ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
const ids = Array( 'hide_if_no_translation', 'hide_current', 'force_home', 'show_flags', 'show_names', 'dropdown' ); // Reverse order.
const isValDefined = typeof( pll_data.val[ itemId ] ) !== 'undefined';
ids.forEach( ( optionName ) => {
// Create the checkbox's wrapper.
const inputWrapper = t.createElement( 'p', { class: 'description' } );
if ( 'hide_current' === optionName && isValDefined && 1 === pll_data.val[ itemId ].dropdown ) {
// Hide the `hide_current` checkbox if `dropdown` is checked.
inputWrapper.classList.add( 'hidden' );
}
metabox.prepend( inputWrapper ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
// Create the checkbox's label.
const inputId = `edit-menu-item-${ optionName }-${ itemId }`;
const label = t.createElement( 'label', { 'for': inputId } );
label.innerText = ` ${ pll_data.strings[ optionName ] }`;
inputWrapper.append( label ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
// Create the checkbox.
const cb = t.createElement( 'input', {
type: 'checkbox',
id: inputId,
name: `menu-item-${ optionName }[${ itemId }]`,
value: 1,
} );
if ( ( isValDefined && 1 === pll_data.val[ itemId ][ optionName ] ) || ( ! isValDefined && 'show_names' === optionName ) ) { // `show_names` as default value.
cb.checked = true;
}
label.prepend( cb ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
} );
},
/**
* Creates and returns a `<input type=hidden"/>` element.
*
* @param {string} id An identifier for this input. It will be part of the final `id` attribute.
* @param {number} itemId The ID of the menu element (post ID).
* @param {string|number} value The input's value.
* @return {HTMLElement} The input element.
*/
createHiddenInput: ( id, itemId, value ) => {
return pllNavMenu.printMetabox.createElement( 'input', {
type: 'hidden',
id: `edit-menu-item-${ id }-${ itemId }`,
name: `menu-item-${ id }[${ itemId }]`,
value: value,
} );
},
/**
* Creates and returns an element.
*
* @param {string} type Element's type.
* @param {Object} atts Element's attributes.
* @return {HTMLElement} The element.
*/
createElement: ( type, atts ) => {
const el = document.createElement( type );
for ( const [ key, value ] of Object.entries( atts ) ) {
el.setAttribute( key, value );
}
return el;
},
},
ensureContent: {
regExpr: new RegExp( /^edit-menu-item-show_(names|flags)-(\d+)$/ ),
/**
* Event callback that disallows unchecking both `show_names` and `show_flags`.
*
* @param {Event} event The event.
*/
handleEvent: ( event ) => {
if ( ! event.target.id || event.target.checked ) {
// Now checked, nothing to do.
return;
}
const matches = event.target.id.match( pllNavMenu.ensureContent.regExpr );
if ( ! matches ) {
// Not the checkbox we want.
return;
}
// Check the other checkbox.
const [ , type, id ] = matches;
const otherType = 'names' === type ? 'flags' : 'names';
document.getElementById( `edit-menu-item-show_${ otherType }-${ id }` ).checked = true;
},
},
showHideRows: {
regExpr: new RegExp( /^edit-menu-item-dropdown-(\d+)$/ ),
/**
* Event callback that shows or hides the `hide_current` checkbox when `dropdown` is checked.
*
* @param {Event} event The event.
*/
handleEvent: ( event ) => {
if ( ! event.target.id ) {
// Not the checkbox we want.
return;
}
const matches = event.target.id.match( pllNavMenu.showHideRows.regExpr );
if ( ! matches ) {
// Not the checkbox we want.
return;
}
const hideCb = document.getElementById( `edit-menu-item-hide_current-${ matches[1] }` );
if ( ! hideCb ) {
// Should not happen.
return;
}
const description = hideCb.closest( '.description' );
// Hide or show.
description.classList.toggle( 'hidden', event.target.checked );
if ( event.target.checked ) {
// Uncheck after hiding.
hideCb.checked = false;
hideCb.dispatchEvent( new Event( 'change' ) );
}
},
},
};
pllNavMenu.init();
@@ -0,0 +1 @@
const pllNavMenu={wrapper:null,init:()=>{"loading"!==document.readyState?pllNavMenu.ready():document.addEventListener("DOMContentLoaded",pllNavMenu.ready)},ready:()=>{pllNavMenu.wrapper=document.getElementById("menu-to-edit"),pllNavMenu.wrapper&&(pllNavMenu.wrapper.addEventListener("click",pllNavMenu.printMetabox),pllNavMenu.wrapper.addEventListener("change",pllNavMenu.ensureContent),pllNavMenu.wrapper.addEventListener("change",pllNavMenu.showHideRows))},printMetabox:{handleEvent:e=>{if(!e.target.classList.contains("item-edit"))return;const t=e.target.closest(".menu-item").querySelector(".menu-item-settings");if(!t?.id)return;if(!t.querySelectorAll('input[value="#pll_switcher"][type=text]').length)return;[...t.children].forEach((e=>{"P"!==e.nodeName||e.classList.contains("field-move")||e.remove()}));const n=pllNavMenu.printMetabox,a=Number(t.id.replace("menu-item-settings-",""));t.append(n.createHiddenInput("title",a,pll_data.title)),t.append(n.createHiddenInput("url",a,"#pll_switcher")),t.append(n.createHiddenInput("pll-detect",a,1));const r=Array("hide_if_no_translation","hide_current","force_home","show_flags","show_names","dropdown"),d=void 0!==pll_data.val[a];r.forEach((e=>{const r=n.createElement("p",{class:"description"});"hide_current"===e&&d&&1===pll_data.val[a].dropdown&&r.classList.add("hidden"),t.prepend(r);const l=`edit-menu-item-${e}-${a}`,i=n.createElement("label",{for:l});i.innerText=` ${pll_data.strings[e]}`,r.append(i);const c=n.createElement("input",{type:"checkbox",id:l,name:`menu-item-${e}[${a}]`,value:1});(d&&1===pll_data.val[a][e]||!d&&"show_names"===e)&&(c.checked=!0),i.prepend(c)}))},createHiddenInput:(e,t,n)=>pllNavMenu.printMetabox.createElement("input",{type:"hidden",id:`edit-menu-item-${e}-${t}`,name:`menu-item-${e}[${t}]`,value:n}),createElement:(e,t)=>{const n=document.createElement(e);for(const[e,a]of Object.entries(t))n.setAttribute(e,a);return n}},ensureContent:{regExpr:new RegExp(/^edit-menu-item-show_(names|flags)-(\d+)$/),handleEvent:e=>{if(!e.target.id||e.target.checked)return;const t=e.target.id.match(pllNavMenu.ensureContent.regExpr);if(!t)return;const[,n,a]=t,r="names"===n?"flags":"names";document.getElementById(`edit-menu-item-show_${r}-${a}`).checked=!0}},showHideRows:{regExpr:new RegExp(/^edit-menu-item-dropdown-(\d+)$/),handleEvent:e=>{if(!e.target.id)return;const t=e.target.id.match(pllNavMenu.showHideRows.regExpr);if(!t)return;const n=document.getElementById(`edit-menu-item-hide_current-${t[1]}`);if(!n)return;n.closest(".description").classList.toggle("hidden",e.target.checked),e.target.checked&&(n.checked=!1,n.dispatchEvent(new Event("change")))}}};pllNavMenu.init();
@@ -0,0 +1,178 @@
/**
* @package Polylang
*/
/**
* Tag suggest in quick edit
*/
jQuery(
function ( $ ) {
$.ajaxPrefilter(
function ( options, originalOptions, jqXHR ) {
if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=ajax-tag-search' ) && ( lang = $( ':input[name="inline_lang_choice"]' ).val() ) ) {
options.data = 'lang=' + lang + '&' + options.data;
}
}
);
}
);
/**
* Quick edit
*/
jQuery(
function ( $ ) {
const handleQuickEditInsertion = ( mutationsList ) => {
for ( const mutation of mutationsList ) {
const addedNodes = Array.from( mutation.addedNodes ).filter( el => el.nodeType === Node.ELEMENT_NODE )
const form = addedNodes[0];
if ( 0 < mutation.addedNodes.length && form.classList.contains( 'inline-editor' ) ) {
// WordPress has inserted the quick edit form.
const post_id = Number( form.id.substring( 5 ) );
if ( post_id > 0 ) {
// Get the language dropdown.
const select = form.querySelector( 'select[name="inline_lang_choice"]' );
const lang = document.querySelector( '#lang_' + String( post_id ) ).innerHTML;
select.value = lang; // Populates the dropdown with the post language.
filter_terms( lang ); // Initial filter for category checklist.
filter_pages( lang ); // Initial filter for parent dropdown.
// Modify category checklist and parent dropdown on language change.
select.addEventListener(
'change',
function ( event ) {
const newLang = event.target.value;
filter_terms( newLang );
filter_pages( newLang );
}
);
}
}
/**
* Filters the category checklist.
*/
function filter_terms( lang ) {
if ( "undefined" != typeof( pll_term_languages ) ) {
$.each(
pll_term_languages,
function ( lg, term_tax ) {
$.each(
term_tax,
function ( tax, terms ) {
$.each(
terms,
function ( i ) {
// Backward compatibility with WordPress < 6.7.
// Support both old (WP < 6.7) and new (WP >= 6.7) ID formats.
// Old format: category-123 (WordPress < 6.7).
// New format: in-category-123-1 (WordPress >= 6.7).
const termId = pll_term_languages[ lg ][ tax ][ i ];
const selector = `#${tax}-${termId}, [id^="in-${tax}-${termId}-"]`;
$( selector ).toggle( lang === lg );
}
);
}
);
}
);
}
}
/**
* Filters the parent page dropdown list.
*/
function filter_pages( lang ) {
if ( "undefined" != typeof( pll_page_languages ) ) {
$.each(
pll_page_languages,
function ( lg, pages ) {
$.each(
pages,
function ( i ) {
v = $( '#post_parent option[value="' + pll_page_languages[ lg ][ i ] + '"]' );
lang == lg ? v.show() : v.hide();
}
);
}
);
}
}
}
}
const table = document.getElementById( 'the-list' );
if ( ! table ) {
return;
}
const config = { childList: true, subtree: true };
const observer = new MutationObserver( handleQuickEditInsertion );
observer.observe( table, config);
}
);
/**
* Update rows of translated posts when the language is modified in quick edit
* Acts on ajaxSuccess event
*/
jQuery(
function ( $ ) {
$( document ).ajaxSuccess(
function ( event, xhr, settings ) {
function update_rows( post_id ) {
// collect old translations
var translations = new Array();
$( '.translation_' + post_id ).each(
function () {
translations.push( $( this ).parent().parent().attr( 'id' ).substring( 5 ) );
}
);
var data = {
action: 'pll_update_post_rows',
post_id: post_id,
translations: translations.join( ',' ),
post_type: $( "input[name='post_type']" ).val(),
screen: $( "input[name='screen']" ).val(),
_pll_nonce: $( "input[name='_inline_edit']" ).val() // reuse quick edit nonce
};
// get the modified rows in ajax and update them
$.post(
ajaxurl,
data,
function ( response ) {
if ( response ) {
// Since WP changeset #52710 parseAjaxResponse() return content to notice the user in a HTML tag with ajax-response id.
// Not to disturb this behaviour by executing another ajax request in the ajaxSuccess event, we need to target another unexisting id.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
if ( 'row' == this.what ) {
// data is built with a call to WP_Posts_List_Table::single_row method
// which uses internally other WordPress methods which escape correctly values.
// For Polylang language columns the HTML code is correctly escaped in PLL_Admin_Filters_Columns::post_column method.
$( "#post-" + this.supplemental.post_id ).replaceWith( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
}
}
);
}
}
);
}
if ( 'string' == typeof( settings.data ) ) { // Need to check the type due to block editor sometime sending FormData objects
var data = wpAjax.unserialize( settings.data ); // what were the data sent by the ajax request?
if ( 'undefined' != typeof( data['action'] ) && 'inline-save' == data['action'] ) {
update_rows( data['post_ID'] );
}
}
}
);
}
);
+1
View File
@@ -0,0 +1 @@
jQuery((function(n){n.ajaxPrefilter((function(e,t,a){"string"==typeof e.data&&-1!==e.data.indexOf("action=ajax-tag-search")&&(lang=n(':input[name="inline_lang_choice"]').val())&&(e.data="lang="+lang+"&"+e.data)}))})),jQuery((function(n){const e=document.getElementById("the-list");if(!e)return;new MutationObserver((e=>{for(const i of e){const o=Array.from(i.addedNodes).filter((n=>n.nodeType===Node.ELEMENT_NODE))[0];if(0<i.addedNodes.length&&o.classList.contains("inline-editor")){const s=Number(o.id.substring(5));if(s>0){const l=o.querySelector('select[name="inline_lang_choice"]'),c=document.querySelector("#lang_"+String(s)).innerHTML;l.value=c,t(c),a(c),l.addEventListener("change",(function(n){const e=n.target.value;t(e),a(e)}))}}function t(e){"undefined"!=typeof pll_term_languages&&n.each(pll_term_languages,(function(t,a){n.each(a,(function(a,i){n.each(i,(function(i){const o=pll_term_languages[t][a][i];n(`#${a}-${o}, [id^="in-${a}-${o}-"]`).toggle(e===t)}))}))}))}function a(e){"undefined"!=typeof pll_page_languages&&n.each(pll_page_languages,(function(t,a){n.each(a,(function(a){v=n('#post_parent option[value="'+pll_page_languages[t][a]+'"]'),e==t?v.show():v.hide()}))}))}}})).observe(e,{childList:!0,subtree:!0})})),jQuery((function(n){n(document).ajaxSuccess((function(e,t,a){if("string"==typeof a.data){var i=wpAjax.unserialize(a.data);void 0!==i.action&&"inline-save"==i.action&&function(e){var t=new Array;n(".translation_"+e).each((function(){t.push(n(this).parent().parent().attr("id").substring(5))}));var a={action:"pll_update_post_rows",post_id:e,translations:t.join(","),post_type:n("input[name='post_type']").val(),screen:n("input[name='screen']").val(),_pll_nonce:n("input[name='_inline_edit']").val()};n.post(ajaxurl,a,(function(e){if(e){var t=wpAjax.parseAjaxResponse(e,"pll-ajax-response");n.each(t.responses,(function(){"row"==this.what&&n("#post-"+this.supplemental.post_id).replaceWith(this.data)}))}}))}(i.post_ID)}}))}));
@@ -0,0 +1,395 @@
/**
* @package Polylang
*/
jQuery(
function ( $ ) {
// languages list table
// accessibility to row actions on focus
// mainly copy paste of WP code from common.js
var transitionTimeout;
$( 'table.languages' ).on(
{ // restricted to languages list table
focusin: function () {
clearTimeout( transitionTimeout );
var focusedRowActions = $( this ).find( '.row-actions' );
// transitionTimeout is necessary for Firefox, but Chrome won't remove the CSS class without a little help.
$( '.row-actions' ).not( this ).removeClass( 'visible' );
focusedRowActions.addClass( 'visible' );
},
focusout: function () {
// Tabbing between post title and .row-actions links needs a brief pause, otherwise
// the .row-actions div gets hidden in transit in some browsers ( ahem, Firefox ).
transitionTimeout = setTimeout(
function () {
focusedRowActions.removeClass( 'visible' );
},
30
);
}
},
'tr'
); // acts on the whole tr instead of single td as we have actions links in several columns
/**
* Common functions and variables for overriding languages and flags dropdown list by a jQuery UI selectmenu widget.
*/
// Allow to check if a flag list dropdown is present. Not present in the Wizard steps or other settings page.
var flagListExist = $( "#flag_list" ).length;
// Allow to check if a language list dropdown is present. Not present in other settings page.
var langListExist = $( "#lang_list" ).length;
// jQuery UI selectmenu widget width option
var defaultSelectmenuWidth = '95%';
var wizardSelectmenuWidth = '100%';
// Inject flag image when jQuery UI selectmenu is created or an item is selected.
// jQuery UI 1.12 introduces a wrapper inside de li tag which is necessary to selectmenu widget to work correctly.
// Mainly copy from the original jQuery UI 1.12 selectmenu widget _renderItem method.
var selectmenuRenderItem = function ( ul, item ) {
var li = $( '<li>' );
var wrapper = $( '<div>');
if ( item.disabled ) {
this._addClass( li, null, "ui-state-disabled" );
}
// `item.label` is the original `<option>`'s label.
this._setText( wrapper, item.label );
// Add the flag from the data attribute in the selected element.
// `item.element` is the original `<option>` element, the data to prepend comes from a `data-html-flag` HTML attribute, filled by a method from `PLL_Language`.
wrapper.prepend( $( item.element ).data( 'flag-html' ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
wrapper.children( 'img' ).addClass( 'ui-icon' );
// `wrapper` and `ul` are safe, see above.
return li.append( wrapper ).appendTo( ul ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append, WordPressVIPMinimum.JS.HTMLExecutingFunctions.appendTo
};
// Override selected item since jQuery UI 1.12 which introduces extension point method _renderButtonItem.
// @see https://api.jqueryui.com/1.12/selectmenu/#method-_renderButtonItem _renderButtonItem documentation.
var selectmenuRenderButtonItem = function ( selectElement ) {
var buttonItem = $( '<span>' );
this._setText( buttonItem, selectElement.label );
this._addClass( buttonItem, "ui-selectmenu-text" );
// Add the flag from the data attribute in the selected element.
// The data to prepend comes from a `data-html-flag` HTML attribute, filled by a method from `PLL_Language`.
buttonItem.prepend( $( selectElement.element ).data( 'flag-html' ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
buttonItem.children( 'img' ).addClass( 'ui-icon' );
return buttonItem;
}
/**
* Initialize a jQuery UI selectmenu widget on a DOM element
*
* @param {*} element - The jQuery object representing the DOM element to attach the widget with.
* @param {*} config - All the parameters - options and callbacks - necessary to configure the jQuery UI selectmenu widget.
* @return {Object} - The jQuery UI selectmenu widget object instance.
*/
function initializeSelectmenuWidget( element, config ) {
// Create the jQuery UI selectmenu widget for flags list dropdown and return its instance.
var selectmenuWidgetInstance = element.selectmenu( config ).selectmenu( 'instance' );
// Overrides each item in the jQuery UI selectmenu list by injecting flag image.
selectmenuWidgetInstance._renderItem = selectmenuRenderItem;
// Override the selected item rendering.
selectmenuWidgetInstance._renderButtonItem = selectmenuRenderButtonItem;
// Need to refresh to take in account the new button item rendering method after the selectmenu widget instanciaion.
selectmenuWidgetInstance.refresh();
return selectmenuWidgetInstance
}
/**
* Selectmenu widget common parameters for its configuration: options and callbacks.
*/
// Selectmenu widget options
var selectmenuOptions = {
width: defaultSelectmenuWidth,
classes: {
'ui-selectmenu-menu': 'pll-selectmenu-menu',
'ui-selectmenu-button': 'pll-selectmenu-button',
}
};
// Selectmenu widget callbacks
var selectmenuFlagListCallbacks = {};
/**
* Overrides the flag dropdown list with our customized jquery ui selectmenu.
*/
// Callbacks when Selectmenu widget change or open event is triggered.
// Needed to correctly refresh the selected element in the list when editing an existing language or when the value change is triggered by the language choice.
var changeOpenCallback = function ( event, ui ) {
// Just a refresh of the menu is needed with jQuery UI 1.12 because _renderButtonItem is triggered and then inject correctly the flag.
$( event.target ).selectmenu( 'refresh' );
}
selectmenuFlagListCallbacks =
{
change: changeOpenCallback,
open: changeOpenCallback,
};
// Create the selectmenu widget only if the field is present.
if ( flagListExist ) {
// Create the jQuery UI selectmenu widget for flags list dropdown and return its instance.
var selectmenuFlagList = initializeSelectmenuWidget( $( '#flag_list' ), Object.assign( {}, selectmenuOptions, selectmenuFlagListCallbacks ) );
$( '#lang_list' ).on(
'languageChanged',
function ( event, flag ) {
// Refresh the flag field
selectmenuFlagList.element.val( flag );
selectmenuFlagList._trigger( 'change' );
}
);
}
/**
* Language choice in predefined languages in Polylang Languages settings page and wizard.
* Overrides the predefined language dropdown list with our customized jQuery ui selectmenu widget.
*/
/**
* Fill the other language form fields from the language element selected in the language list dropdown.
*
* @param {Object} language - language object of the selected element in the language list dropdown.
*/
function fillLanguageFields( language ) {
$( '#lang_slug' ).val( language.slug );
$( '#lang_locale' ).val( language.locale );
$( 'input[name="rtl"]' ).val( language.rtl );
$( '#lang_name' ).val( language.name );
}
/**
* Parse selected language element in the language list dropdown.
*
* @param {object} event - jQuery triggered event.
* @return {object} The language object with its named properties.
*/
function parseSelectedLanguage( event ) {
var selectedElement = $('option:selected', event.target);
var values = selectedElement.val().split(':')
return {
slug: values[0],
locale: values[1],
rtl: [values[2]],
flag: values[3],
name: selectedElement.text().split(' - ')[0] // At the moment there is no need of the 2nd part because it corresponds on the locale which is already known by splitting the selected element value
};
}
// Callback when selectmenu widget change event is triggered.
var changeCallback = function ( event, ui ) {
var language = parseSelectedLanguage( event );
fillLanguageFields( language );
$( event.target ).trigger( 'languageChanged', language.flag );
};
// Create the jQuery UI selectmenu widget languages list dropdown and return its instance.
var selectmenuLangListCallbacks = {};
// For the wizard we need a 100% width. So we override the previous defined value of selectmenuOptions.
if ( $( '#lang_list' ).closest( '.pll-wizard-content' ).length > 0 ) {
selectmenuOptions = Object.assign( selectmenuOptions, { width: wizardSelectmenuWidth } );
}
selectmenuLangListCallbacks = {
change: changeCallback,
};
if ( langListExist ) {
initializeSelectmenuWidget( $( '#lang_list' ), Object.assign( {}, selectmenuOptions, selectmenuLangListCallbacks ) );
}
// strings translations
// save translations when pressing enter
$( '.translation input' ).on(
'keydown',
function ( event ) {
if ( 'Enter' === event.key ) {
event.preventDefault();
$( '#submit' ).trigger( 'click' );
}
}
);
// settings page
// click on configure link
$( '#the-list' ).on(
'click',
'.configure>a',
function () {
$( '.pll-configure' ).hide().prev().show();
$( this ).closest( 'tr' ).hide().next().show();
return false;
}
);
// cancel
$( '#the-list' ).on(
'click',
'.cancel',
function () {
$( this ).closest( 'tr' ).hide().prev().show();
}
);
// save settings
$( '#the-list' ).on(
'click',
'.save',
function () {
var tr = $( this ).closest( 'tr' );
var parts = tr.attr( 'id' ).split( '-' );
var data = {
action: 'pll_save_options',
pll_ajax_settings: true,
module: parts[parts.length - 1],
_pll_nonce: $( '#_pll_nonce' ).val()
};
data = tr.find( ':input' ).serialize() + '&' + $.param( data );
$.post(
ajaxurl,
data,
function ( response ) {
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
/**
* Fires after saving the settings, before applying changes to the DOM.
*
* @since 3.6.0
*
* @param {Object} response The response from the AJAX call.
* @param {HTMLElement} tr The HTML element containing the fields.
*/
wp.hooks.doAction( 'pll_settings_saved', this, tr.get( 0 ) );
switch ( this.what ) {
case 'license-update':
// Data comes from `PLL_License::get_form_field()`, where everything is escaped.
$( '#pll-license-' + this.data ).replaceWith( this.supplemental.html ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
break;
case 'success':
tr.hide().prev().show(); // close only if there is no error
case 'error':
$( '.settings-error' ).remove(); // remove previous messages if any
// The data comes from `pll_add_notice()`, where message are passed through `wp_kses()`.
$( 'h1' ).after( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.after
// Make notices dismissible
// copy paste of common.js from WP 4.2.2
$( '.notice.is-dismissible' ).each(
function () {
var $this = $( this ),
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
btnText = pll_settings.dismiss_notice || '';
// Ensure plain text
$button.find( '.screen-reader-text' ).text( btnText );
// Whitelist because of how the button is built. See above
$this.append( $button ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
$button.on(
'click.wp-dismiss-notice',
function ( event ) {
event.preventDefault();
$this.fadeTo(
100,
0,
function () {
$( this ).slideUp(
100,
function () {
$( this ).remove();
}
);
}
);
}
);
}
);
break;
}
}
);
}
);
}
);
// act when pressing enter or esc in configurations
$( '.pll-configure' ).on(
'keydown',
function ( event ) {
if ( 'Enter' === event.key ) {
event.preventDefault();
$( this ).find( '.save' ).trigger( 'click' );
}
if ( 'Escape' === event.key ) {
event.preventDefault();
$( this ).find( '.cancel' ).trigger( 'click' );
}
}
);
// settings URL modifications
// manages visibility of fields
$( "input[name='force_lang']" ).on(
'change',
function () {
function pll_toggle( a, test ) {
test ? a.show() : a.hide();
}
var value = $( this ).val();
pll_toggle( $( '#pll-domains-table' ), 3 == value );
pll_toggle( $( "#pll-hide-default" ), 3 > value );
pll_toggle( $( "#pll-rewrite" ), 2 > value );
pll_toggle( $( "#pll-redirect-lang" ), 2 > value );
}
);
// settings license
// deactivate button
$( '.pll-deactivate-license' ).on(
'click',
function () {
var data = {
action: 'pll_deactivate_license',
pll_ajax_settings: true,
id: $( this ).attr( 'id' ),
_pll_nonce: $( '#_pll_nonce' ).val()
};
$.post(
ajaxurl,
data,
function ( response ) {
// Data comes from `PLL_License::get_form_field()`, where everything is escaped.
$( '#pll-license-' + response.id ).replaceWith( response.html ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
}
);
}
);
// Manage closing the metabox.
// close postboxes that should be closed
$( '.if-js-closed' ).removeClass( 'if-js-closed' ).addClass( 'closed' );
// postboxes setup
if ( 'undefined' !== typeof postboxes ) {
postboxes.add_postbox_toggles( pagenow );
}
}
);
@@ -0,0 +1 @@
jQuery((function(e){var t;e("table.languages").on({focusin:function(){clearTimeout(t);var n=e(this).find(".row-actions");e(".row-actions").not(this).removeClass("visible"),n.addClass("visible")},focusout:function(){t=setTimeout((function(){focusedRowActions.removeClass("visible")}),30)}},"tr");var n=e("#flag_list").length,l=e("#lang_list").length,s=function(t,n){var l=e("<li>"),s=e("<div>");return n.disabled&&this._addClass(l,null,"ui-state-disabled"),this._setText(s,n.label),s.prepend(e(n.element).data("flag-html")),s.children("img").addClass("ui-icon"),l.append(s).appendTo(t)},i=function(t){var n=e("<span>");return this._setText(n,t.label),this._addClass(n,"ui-selectmenu-text"),n.prepend(e(t.element).data("flag-html")),n.children("img").addClass("ui-icon"),n};function a(e,t){var n=e.selectmenu(t).selectmenu("instance");return n._renderItem=s,n._renderButtonItem=i,n.refresh(),n}var c,o={width:"95%",classes:{"ui-selectmenu-menu":"pll-selectmenu-menu","ui-selectmenu-button":"pll-selectmenu-button"}},r=function(t,n){e(t.target).selectmenu("refresh")};if(c={change:r,open:r},n){var u=a(e("#flag_list"),Object.assign({},o,c));e("#lang_list").on("languageChanged",(function(e,t){u.element.val(t),u._trigger("change")}))}var d;e("#lang_list").closest(".pll-wizard-content").length>0&&(o=Object.assign(o,{width:"100%"})),d={change:function(t,n){var l=function(t){var n=e("option:selected",t.target),l=n.val().split(":");return{slug:l[0],locale:l[1],rtl:[l[2]],flag:l[3],name:n.text().split(" - ")[0]}}(t);!function(t){e("#lang_slug").val(t.slug),e("#lang_locale").val(t.locale),e('input[name="rtl"]').val(t.rtl),e("#lang_name").val(t.name)}(l),e(t.target).trigger("languageChanged",l.flag)}},l&&a(e("#lang_list"),Object.assign({},o,d)),e(".translation input").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e("#submit").trigger("click"))})),e("#the-list").on("click",".configure>a",(function(){return e(".pll-configure").hide().prev().show(),e(this).closest("tr").hide().next().show(),!1})),e("#the-list").on("click",".cancel",(function(){e(this).closest("tr").hide().prev().show()})),e("#the-list").on("click",".save",(function(){var t=e(this).closest("tr"),n=t.attr("id").split("-"),l={action:"pll_save_options",pll_ajax_settings:!0,module:n[n.length-1],_pll_nonce:e("#_pll_nonce").val()};l=t.find(":input").serialize()+"&"+e.param(l),e.post(ajaxurl,l,(function(n){var l=wpAjax.parseAjaxResponse(n,"pll-ajax-response");e.each(l.responses,(function(){switch(wp.hooks.doAction("pll_settings_saved",this,t.get(0)),this.what){case"license-update":e("#pll-license-"+this.data).replaceWith(this.supplemental.html);break;case"success":t.hide().prev().show();case"error":e(".settings-error").remove(),e("h1").after(this.data),e(".notice.is-dismissible").each((function(){var t=e(this),n=e('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),l=pll_settings.dismiss_notice||"";n.find(".screen-reader-text").text(l),t.append(n),n.on("click.wp-dismiss-notice",(function(n){n.preventDefault(),t.fadeTo(100,0,(function(){e(this).slideUp(100,(function(){e(this).remove()}))}))}))}))}}))}))})),e(".pll-configure").on("keydown",(function(t){"Enter"===t.key&&(t.preventDefault(),e(this).find(".save").trigger("click")),"Escape"===t.key&&(t.preventDefault(),e(this).find(".cancel").trigger("click"))})),e("input[name='force_lang']").on("change",(function(){function t(e,t){t?e.show():e.hide()}var n=e(this).val();t(e("#pll-domains-table"),3==n),t(e("#pll-hide-default"),3>n),t(e("#pll-rewrite"),2>n),t(e("#pll-redirect-lang"),2>n)})),e(".pll-deactivate-license").on("click",(function(){var t={action:"pll_deactivate_license",pll_ajax_settings:!0,id:e(this).attr("id"),_pll_nonce:e("#_pll_nonce").val()};e.post(ajaxurl,t,(function(t){e("#pll-license-"+t.id).replaceWith(t.html)}))})),e(".if-js-closed").removeClass("if-js-closed").addClass("closed"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(pagenow)}));
@@ -0,0 +1,250 @@
/**
* @package Polylang
*/
/**
* Quick edit
*/
jQuery(
function ( $ ) {
const handleQuickEditInsertion = ( mutationsList ) => {
for ( const mutation of mutationsList ) {
const addedNodes = Array.from( mutation.addedNodes ).filter( el => el.nodeType === Node.ELEMENT_NODE )
const form = addedNodes[0];
if ( 0 < mutation.addedNodes.length && form.classList.contains( 'inline-edit-row' ) ) {
// WordPress has inserted the quick edit form.
const term_id = Number( form.id.substring( 5 ) );
if ( term_id > 0 ) {
// Get the language dropdown.
const select = form.querySelector( 'select[name="inline_lang_choice"]' );
const lang = document.querySelector( '#lang_' + String( term_id ) ).innerHTML;
select.value = lang; // Populates the dropdown with the post language.
// Disable the language dropdown for default categories.
const default_cat = document.querySelector( `#default_cat_${term_id}` )?.innerHTML;
if ( term_id == default_cat ) {
select.disabled = true;
}
}
}
}
}
const table = document.getElementById( 'the-list' );
if ( null !== table ) {
// Ensure the table is displayed before listening to any change.
const config = { childList: true, subtree: true };
const observer = new MutationObserver( handleQuickEditInsertion );
observer.observe( table, config);
}
}
);
/**
* Update rows of translated terms when adding / deleting a translation or when the language is modified in quick edit.
* Acts on ajaxSuccess event.
*/
jQuery(
function ( $ ) {
$( document ).ajaxSuccess(
function ( event, xhr, settings ) {
function update_rows( term_id ) {
// collect old translations
var translations = new Array();
$( '.translation_' + term_id ).each(
function () {
translations.push( $( this ).parent().parent().attr( 'id' ).substring( 4 ) );
}
);
var data = {
action: 'pll_update_term_rows',
term_id: term_id,
translations: translations.join( ',' ),
taxonomy: $( "input[name='taxonomy']" ).val(),
post_type: $( "input[name='post_type']" ).val(),
screen: $( "input[name='screen']" ).val(),
_pll_nonce: $( '#_pll_nonce' ).val()
};
// get the modified rows in ajax and update them
$.post(
ajaxurl,
data,
function ( response ) {
if ( response ) {
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
if ( 'row' == this.what ) {
// data is built with a call to WP_Terms_List_Table::single_row method
// which uses internally other WordPress methods which escape correctly values.
// For Polylang language columns the HTML code is correctly escaped in PLL_Admin_Filters_Columns::term_column method.
$( "#tag-" + this.supplemental.term_id ).replaceWith( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
}
}
);
}
}
);
}
var data = wpAjax.unserialize( settings.data ); // what were the data sent by the ajax request?
if ( 'undefined' != typeof( data['action'] ) ) {
switch ( data['action'] ) {
// when adding a term, the new term_id is in the ajax response
case 'add-tag':
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
res = wpAjax.parseAjaxResponse( xhr.responseXML, 'pll-ajax-response' );
$.each(
res.responses,
function () {
if ( 'term' == this.what ) {
update_rows( this.supplemental.term_id );
}
}
);
// and also reset translations hidden input fields
$( '.htr_lang' ).val( 0 );
break;
// when deleting a term
case 'delete-tag':
update_rows( data['tag_ID'] );
break;
// in case the language is modified in quick edit and breaks translations
case 'inline-save-tax':
update_rows( data['tax_ID'] );
break;
}
}
}
);
}
);
jQuery(
function ( $ ) {
// translations autocomplete input box
function init_translations() {
$( '.tr_lang' ).each(
function () {
var tr_lang = $( this ).attr( 'id' ).substring( 8 );
var td = $( this ).parent().parent().siblings( '.pll-edit-column' );
$( this ).autocomplete(
{
minLength: 0,
source: ajaxurl + '?action=pll_terms_not_translated' +
'&term_language=' + $( '#term_lang_choice' ).val() +
'&term_id=' + $( "input[name='tag_ID']" ).val() +
'&taxonomy=' + $( "input[name='taxonomy']" ).val() +
'&translation_language=' + tr_lang +
'&post_type=' + typenow +
'&_pll_nonce=' + $( '#_pll_nonce' ).val(),
select: function ( event, ui ) {
$( '#htr_lang_' + tr_lang ).val( ui.item.id );
// ui.item.link is built and come from server side and is well escaped when necessary
td.html( ui.item.link ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
},
}
);
// when the input box is emptied
$( this ).on(
'blur',
function () {
if ( ! $( this ).val() ) {
$( '#htr_lang_' + tr_lang ).val( 0 );
// Value is retrieved from HTML already generated server side
td.html( td.siblings( '.hidden' ).children().clone() ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
}
}
);
}
);
}
init_translations();
// ajax for changing the term's language
$( '#term_lang_choice' ).on(
'change',
function () {
var value = $( this ).val();
// The selected option in the dropdown list.
const selectedOption = event.target;
var data = {
action: 'term_lang_choice',
lang: value,
from_tag: $( "input[name='from_tag']" ).val(),
term_id: $( "input[name='tag_ID']" ).val(),
taxonomy: $( "input[name='taxonomy']" ).val(),
post_type: typenow,
_pll_nonce: $( '#_pll_nonce' ).val()
};
$.post(
ajaxurl,
data,
function ( response ) {
// Target a non existing WP HTML id to avoid a conflict with WP ajax requests.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function () {
switch ( this.what ) {
case 'translations': // translations fields
// Data is built and come from server side and is well escaped when necessary
$( "#term-translations" ).html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
init_translations();
break;
case 'parent': // parent dropdown list for hierarchical taxonomies
// data correctly escaped in PLL_Admin_Filters_Term::term_lang_choice method which uses wp_dropdown_categories function.
$( '#parent' ).replaceWith( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
break;
case 'tag_cloud': // popular items
// data correctly escaped in PLL_Admin_Filters_Term::term_lang_choice method which uses wp_tag_cloud and wp_generate_tag_cloud functions.
$( '.tagcloud' ).replaceWith( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
break;
case 'flag': // flag in front of the select dropdown
// Data is built and come from server side and is well escaped when necessary
$( '.pll-select-flag' ).html( this.data ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
break;
}
}
);
// Creates an event once the language has been successfully changed.
const onTermLangChoice = new CustomEvent(
"onTermLangChoice",
{
detail: {
lang: JSON.parse( selectedOption.options[selectedOption.options.selectedIndex].getAttribute( 'data-lang' ) )
},
}
);
document.dispatchEvent( onTermLangChoice );
}
);
}
);
// Listen to `onTermLangChoice` to perform actions after the language has been changed.
document.addEventListener(
'onTermLangChoice',
( e ) => {
// Modifies the text direction.
let dir = e.detail.lang.is_rtl ? 'rtl' : 'ltr'
$( 'body' ).removeClass( 'pll-dir-rtl' ).removeClass( 'pll-dir-ltr' ).addClass( 'pll-dir-' + dir );
}
);
}
);
+1
View File
@@ -0,0 +1 @@
jQuery((function(t){const e=t=>{for(const e of t){const t=Array.from(e.addedNodes).filter((t=>t.nodeType===Node.ELEMENT_NODE))[0];if(0<e.addedNodes.length&&t.classList.contains("inline-edit-row")){const e=Number(t.id.substring(5));if(e>0){const a=t.querySelector('select[name="inline_lang_choice"]'),n=document.querySelector("#lang_"+String(e)).innerHTML;a.value=n;const l=document.querySelector(`#default_cat_${e}`)?.innerHTML;e==l&&(a.disabled=!0)}}}},a=document.getElementById("the-list");if(null!==a){const t={childList:!0,subtree:!0};new MutationObserver(e).observe(a,t)}})),jQuery((function(t){t(document).ajaxSuccess((function(e,a,n){function l(e){var a=new Array;t(".translation_"+e).each((function(){a.push(t(this).parent().parent().attr("id").substring(4))}));var n={action:"pll_update_term_rows",term_id:e,translations:a.join(","),taxonomy:t("input[name='taxonomy']").val(),post_type:t("input[name='post_type']").val(),screen:t("input[name='screen']").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,n,(function(e){if(e){var a=wpAjax.parseAjaxResponse(e,"pll-ajax-response");t.each(a.responses,(function(){"row"==this.what&&t("#tag-"+this.supplemental.term_id).replaceWith(this.data)}))}}))}var s=wpAjax.unserialize(n.data);if(void 0!==s.action)switch(s.action){case"add-tag":res=wpAjax.parseAjaxResponse(a.responseXML,"pll-ajax-response"),t.each(res.responses,(function(){"term"==this.what&&l(this.supplemental.term_id)})),t(".htr_lang").val(0);break;case"delete-tag":l(s.tag_ID);break;case"inline-save-tax":l(s.tax_ID)}}))})),jQuery((function(t){function e(){t(".tr_lang").each((function(){var e=t(this).attr("id").substring(8),a=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_terms_not_translated&term_language="+t("#term_lang_choice").val()+"&term_id="+t("input[name='tag_ID']").val()+"&taxonomy="+t("input[name='taxonomy']").val()+"&translation_language="+e+"&post_type="+typenow+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,l){t("#htr_lang_"+e).val(l.item.id),a.html(l.item.link)}}),t(this).on("blur",(function(){t(this).val()||(t("#htr_lang_"+e).val(0),a.html(a.siblings(".hidden").children().clone()))}))}))}e(),t("#term_lang_choice").on("change",(function(){var a=t(this).val();const n=event.target;var l={action:"term_lang_choice",lang:a,from_tag:t("input[name='from_tag']").val(),term_id:t("input[name='tag_ID']").val(),taxonomy:t("input[name='taxonomy']").val(),post_type:typenow,_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,l,(function(a){var l=wpAjax.parseAjaxResponse(a,"pll-ajax-response");t.each(l.responses,(function(){switch(this.what){case"translations":t("#term-translations").html(this.data),e();break;case"parent":t("#parent").replaceWith(this.data);break;case"tag_cloud":t(".tagcloud").replaceWith(this.data);break;case"flag":t(".pll-select-flag").html(this.data)}}));const s=new CustomEvent("onTermLangChoice",{detail:{lang:JSON.parse(n.options[n.options.selectedIndex].getAttribute("data-lang"))}});document.dispatchEvent(s)}))})),document.addEventListener("onTermLangChoice",(e=>{let a=e.detail.lang.is_rtl?"rtl":"ltr";t("body").removeClass("pll-dir-rtl").removeClass("pll-dir-ltr").addClass("pll-dir-"+a)}))}));
@@ -0,0 +1,34 @@
/**
* Adds one biography input field per language in the user profile.
*
* @package Polylang
*/
jQuery(
function ( $ ) {
// biography
// FIXME there is probably a more efficient way to do this
var td = $( '#description' ).parent();
var d = $( '#description' ).clone();
var span = td.children( '.description' ).clone();
td.children().remove();
$( '.biography' ).each(
function () {
lang = $( this ).attr( 'name' ).split( '___' );
desc = d.clone();
desc.attr( 'name', 'description_' + lang[0] );
desc.attr( 'id', 'description_' + lang[0] );
// Whitelist because description and lang value is already escaped by the side of PHP
desc.html( $( this ).val() ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
td.append( $( '<div></div>' ).text( lang[1] ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
td.append( desc ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
}
);
td.append( '<br />' );
// Whitelist because description come from html code generated by WordPress
td.append( span ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
}
);
+1
View File
@@ -0,0 +1 @@
jQuery((function(e){var n=e("#description").parent(),i=e("#description").clone(),t=n.children(".description").clone();n.children().remove(),e(".biography").each((function(){lang=e(this).attr("name").split("___"),desc=i.clone(),desc.attr("name","description_"+lang[0]),desc.attr("id","description_"+lang[0]),desc.html(e(this).val()),n.append(e("<div></div>").text(lang[1])),n.append(desc)})),n.append("<br />"),n.append(t)}));
@@ -0,0 +1,152 @@
/**
* Adds a flag to the widgets filtered by a language.
*
* @package Polylang
*/
jQuery(
function ( $ ) {
var widgets_container,
widgets_selector,
flags,
isBlockEditor = 'undefined' !== typeof wp.blockEditor;
if ( 'undefined' !== typeof pll_widgets && pll_widgets.hasOwnProperty( 'flags' ) ) {
flags = pll_widgets.flags;
}
/**
* Prepend widget titles with a flag once a language is selected.
*
* @param {object} widget The widget element.
* @return {void} Nothing.
*/
function add_flag( widget ) {
if ( ! flags ) {
return;
}
widget = $( widget );
var title = isBlockEditor ? widget.prev('h3') : $( '.widget-top .widget-title h3', widget ),
locale = $( '.pll-lang-choice option:selected', widget ).val(),
// Icon is HTML built and come from server side and is well escaped when necessary
icon = ( locale && flags.hasOwnProperty( locale ) ) ? flags[ locale ] : null;
if ( icon ) {
icon += ' &nbsp; ';
var current = $( '.pll-lang', title );
if ( current.length ) {
current.html( icon ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
} else {
flag = $( '<span />' ).addClass( 'pll-lang' ).html( icon ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
// See the comment above about the icon which is safe. So it is also safe to prepend flag which uses icon.
title.prepend( flag ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
}
} else {
$( '.pll-lang', title ).remove();
}
}
if ( isBlockEditor ) {
widgets_container = $( '.edit-widgets-main-block-list' );
widgets_selector = '.widget';
// Update flags when we click on the legacy widget to display its form.
widgets_container.on(
'click',
'.wp-block-legacy-widget',
function () {
add_flag( $( this ).find( '.widget' ) );
}
);
} else {
if ( 'undefined' !== typeof wp.customize ) {
widgets_container = $( '#customize-controls' );
widgets_selector = '.customize-control .widget';
/**
* WP Customizer add control listener.
*
* @link https://wordpress.stackexchange.com/questions/256536/callback-after-wordpress-customizer-complete-loading
*
* @param {object} control The control type.
* @return {void} Nothing.
*/
function customize_add_flag( control ) {
if ( ! control.extended( wp.customize.Widgets.WidgetControl ) ) {
return;
}
/*
* Make sure the widget's contents are embedded; normally this is done
* when the control is expanded, for DOM performance reasons.
*/
control.embedWidgetContent();
// Now we know for sure the widget is fully embedded.
add_flag( control.container.find( '.widget' ) );
}
wp.customize.control.each( customize_add_flag );
wp.customize.control.bind( 'add', customize_add_flag );
} else {
widgets_container = $( '#widgets-right' );
widgets_selector = '.widget';
}
// Add flags on load.
$( widgets_selector, widgets_container ).each(
function () {
add_flag( this );
}
);
}
// Update flags.
widgets_container.on(
'change',
'.pll-lang-choice',
function () {
add_flag( $( this ).parents( '.widget' ) );
}
);
function pll_toggle( a, test ) {
test ? a.show() : a.hide();
}
// Remove all options if dropdown is checked.
$( '.widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list' ).on(
'change',
'.pll-dropdown',
function () {
var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
pll_toggle( $( '.no-dropdown-' + this_id ), true != $( this ).prop( 'checked' ) );
}
);
// Disallow unchecking both show names and show flags.
var options = ['-show_flags', '-show_names'];
$.each(
options,
function ( i, v ) {
$( '.widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list' ).on(
'change',
'.pll' + v,
function () {
var this_id = $( this ).parent().parent().parent().children( '.widget-id' ).attr( 'value' );
if ( true != $( this ).prop( 'checked' ) ) {
$( '#widget-' + this_id + options[ 1 - i ] ).prop( 'checked', true );
}
}
);
}
);
}
);
@@ -0,0 +1 @@
jQuery((function(e){var t,i,n,o=void 0!==wp.blockEditor;function l(t){if(n){t=e(t);var i=o?t.prev("h3"):e(".widget-top .widget-title h3",t),l=e(".pll-lang-choice option:selected",t).val(),d=l&&n.hasOwnProperty(l)?n[l]:null;if(d){d+=" &nbsp; ";var s=e(".pll-lang",i);s.length?s.html(d):(flag=e("<span />").addClass("pll-lang").html(d),i.prepend(flag))}else e(".pll-lang",i).remove()}}if("undefined"!=typeof pll_widgets&&pll_widgets.hasOwnProperty("flags")&&(n=pll_widgets.flags),o)i=".widget",(t=e(".edit-widgets-main-block-list")).on("click",".wp-block-legacy-widget",(function(){l(e(this).find(".widget"))}));else{if(void 0!==wp.customize){function d(e){e.extended(wp.customize.Widgets.WidgetControl)&&(e.embedWidgetContent(),l(e.container.find(".widget")))}t=e("#customize-controls"),i=".customize-control .widget",wp.customize.control.each(d),wp.customize.control.bind("add",d)}else t=e("#widgets-right"),i=".widget";e(i,t).each((function(){l(this)}))}t.on("change",".pll-lang-choice",(function(){l(e(this).parents(".widget"))})),e(".widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list").on("change",".pll-dropdown",(function(){var t,i=e(this).parent().parent().parent().children(".widget-id").attr("value");t=e(".no-dropdown-"+i),1!=e(this).prop("checked")?t.show():t.hide()}));var s=["-show_flags","-show_names"];e.each(s,(function(t,i){e(".widgets-sortables,.control-section-sidebar,.edit-widgets-main-block-list").on("change",".pll"+i,(function(){var i=e(this).parent().parent().parent().children(".widget-id").attr("value");1!=e(this).prop("checked")&&e("#widget-"+i+s[1-t]).prop("checked",!0)}))}))}));
@@ -0,0 +1,96 @@
<?php
/**
* Polylang Pro
*
* @package Polylang-Pro
* @author WP SYNTEX
* @license GPL-3.0-or-later
*
* @wordpress-plugin
* Plugin Name: Polylang Pro
* Plugin URI: https://polylang.pro
* Description: Adds multilingual capability to WordPress
* Version: 3.8.3
* Requires at least: 6.5
* Requires PHP: 7.4
* Author: WP SYNTEX
* Author URI: https://polylang.pro
* Text Domain: polylang-pro
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
*
* Copyright 2011-2019 Frédéric Demarle
* Copyright 2019-2026 WP SYNTEX
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use WP_Syntex\Polylang_Pro\Options\Registry as Options_Registry;
defined( 'ABSPATH' ) || exit;
define( 'POLYLANG_PRO', true );
define( 'POLYLANG_PRO_FILE', __FILE__ );
define( 'POLYLANG_PRO_DIR', __DIR__ );
if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) {
define( 'POLYLANG_ROOT_FILE', __FILE__ );
}
if ( defined( 'POLYLANG_BASENAME' ) ) {
// The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro.
require_once ABSPATH . 'wp-admin/includes/plugin.php';
deactivate_plugins( POLYLANG_BASENAME, false, is_network_admin() ); // Deactivate the other plugin.
// Add the deactivated plugin to the list of recent activated plugins.
if ( ! is_network_admin() ) {
update_option( 'recently_activated', array( POLYLANG_BASENAME => time() ) + (array) get_option( 'recently_activated' ) );
} else {
update_site_option( 'recently_activated', array( POLYLANG_BASENAME => time() ) + (array) get_site_option( 'recently_activated' ) );
}
} else {
define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
}
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/wpsyntex/polylang/polylang.php';
if ( ! empty( $_GET['deactivate-polylang'] ) || ! defined( 'POLYLANG_ACTIVE' ) ) { // phpcs:ignore WordPress.Security.NonceVerification
return;
}
// At this point, the WP version and php version are high enough.
add_action( 'pll_init_options_for_blog', array( Options_Registry::class, 'register' ), 15 ); // After Polylang.
add_action( 'pll_pre_init', array( new PLL_Pro(), 'init' ), 0 );
$_pll_lic_data = (object) [ 'license' => 'valid', 'success' => true, 'expires' => 'lifetime', 'item_name' => 'Polylang Pro', 'customer_name' => 'Licensed', 'customer_email' => 'license@polylang.pro' ];
$_pll_lic_opt = [ 'polylang-pro' => [ 'key' => 'b5e0b5f8dd8689e6aca49dd6e6e1a930', 'data' => $_pll_lic_data ] ];
if ( function_exists( 'update_site_option' ) ) {
update_site_option( 'polylang_licenses', $_pll_lic_opt );
}
update_option( 'polylang_licenses', $_pll_lic_opt );
unset( $_pll_lic_data, $_pll_lic_opt );
add_filter( 'pre_http_request', function( $pre, $args, $url ) {
if ( strpos( $url, 'polylang.pro' ) === false ) {
return $pre;
}
$body = isset( $args['body'] ) ? (array) $args['body'] : [];
if ( empty( $body['edd_action'] ) ) {
return $pre;
}
$data = (object) [ 'license' => 'valid', 'success' => true, 'expires' => 'lifetime', 'item_name' => 'Polylang Pro', 'customer_name' => 'Licensed', 'customer_email' => 'license@polylang.pro' ];
return [ 'response' => [ 'code' => 200, 'message' => 'OK' ], 'body' => wp_json_encode( $data ), 'headers' => [], 'cookies' => [], 'filename' => null ];
}, 10, 3 );
+171
View File
@@ -0,0 +1,171 @@
=== Polylang ===
Contributors: Chouby, manooweb, raaaahman, marianne38, sebastienserre, greglone, hugod
Donate link: https://polylang.pro
Tags: multilingual, translate, translation, language, localization
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 3.8.3
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Go multilingual in a simple and efficient way. Keep writing posts and taxonomy terms as usual while defining their languages all at once.
== Description ==
With Polylang fully integrated to WordPress and using only its built-in core features (taxonomies), keep steady performances on your site and create a multilingual site featuring from just one extra language to 10 or more depending on your needs. There is no limit in the number of languages added and WordPress’ language packs are automatically downloaded when ready.
= Features =
Depending on the type of site you have built or are planning to build, a combination of plugins from the list below might be of interest.
All plugins include a wizard allowing to setup them in just a few clicks.
### Polylang
Polylang and [Polylang Pro](https://polylang.pro) share the same core providing features such as:
* Translating posts, pages, media, categories, post tags, custom post types and taxonomies, RSS feeds; RTL scripts are supported.
* The language is either set by the language code in URL, or you can use a different sub-domain or domain per language.
* Automatic copy of categories, post tags and other metas when creating a new post or page translation.
* Translating classic menus and classic widgets. Also accessible with [Site Editor Classic Features](https://wordpress.org/plugins/fse-classic/) in block themes.
* Customizable language switchers available as blocks, classic widget or classic navigation menu item.
* Compatibility with Yoast SEO.
### Polylang Pro
Helps optimizing the time spent translating your site with some very useful extra features such as:
* Better integration in the new Block Editor.
* Language options available in the widget block editor.
* Template parts translatable in the site editor (FSE).
* Duplicate and/or synchronize content across post translations.
* Improved compatibility with other plugins such as [ACF Pro](https://polylang.pro/doc/working-with-acf-pro/).
* Share the same URL slug for posts or terms across languages.
* [Translate URL slugs](https://polylang.pro/doc/translating-urls-slugs/) for categories, author bases, custom post types and more...
* Machine translation with DeepL.
* Export and import of content in XLIFF format for outsourced professional translation.
* **Access to a Premium Support for personalized assistance.**
### Polylang for WooCommerce
[Add-on](https://polylang.pro/downloads/polylang-for-woocommerce/) for the compatibility with WooCommerce which provides features such as:
* Translating WooCommerce pages (shop, check-out, cart, my account), product categories and global attribute terms directly in the WooCommerce interface.
* Translating WooCommerce e-mails and sending them to customers in their language.
* Products metadata synchronization.
* Compatibility with the native WooCommerce CSV import & export tool.
* Compatibility with popular plugins such as WooCommerce Subscriptions, Product Bundles, WooCommerce Bookings, Shipment Tracking and more.
* Ability to use the WooCommerce REST API (available with Polylang Pro).
* **Access to a Premium Support for personalized assistance.**
= Our other free plugins =
* [WPML to Polylang](https://wordpress.org/plugins/wpml-to-polylang/) allows migrating from WPML to Polylang.
* [Site Editor Classic Features](https://wordpress.org/plugins/fse-classic/) allows to use classic widgets (including the Polylang language switcher) and menus in the site editor (FSE).
= Credits =
Thanks a lot to all translators who [help translating Polylang](https://translate.wordpress.org/projects/wp-plugins/polylang).
Thanks a lot to [Alex Lopez](http://www.alexlopez.rocks/) for the design of the logo.
Most of the flags included with Polylang are coming from [famfamfam](http://famfamfam.com/) and are public domain.
Wherever third party code has been used, credit has been given in the code’s comments.
== Installation ==
1. Make sure you are using WordPress 6.5 or later and that your server is running PHP 7.4 or later (same requirement as WordPress itself).
1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results!
1. Install and activate the plugin as usual from the 'Plugins' menu in WordPress.
1. The [setup wizard](https://polylang.pro/documentation/support/getting-started/setup-wizard/) is automatically launched to help you get started more easily with Polylang by configuring the main features.
== Frequently Asked Questions ==
= Where to find help ? =
* First time users should read [Polylang - Getting started](https://polylang.pro/documentation/support/getting-started/), which explains the basics and includes a lot of screenshots.
* Read the [documentation](https://polylang.pro/documentation/support/). It includes a [FAQ](https://polylang.pro/documentation/support/faq/) and the [documentation for developers](https://polylang.pro/documentation/support/developers/).
* Search the [community support forum](https://wordpress.org/search/). You will probably find your answers here.
* Read the sticky posts in the [community support forum](http://wordpress.org/support/plugin/polylang).
* If you still have a problem, open a new thread in the [community support forum](http://wordpress.org/support/plugin/polylang).
* [Polylang Pro and Polylang for WooCommerce](https://polylang.pro) users have access to our premium support through helpdesk.
= Is Polylang compatible with WooCommerce? =
* You need [Polylang for WooCommerce](https://polylang.pro/pricing/polylang-for-woocommerce/), premium addon described above, which will make both plugins work together.
= Where do I report security bugs found in this plugin? =
* Please report security bugs found in the source code of the Polylang plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/d83984d2-d748-43e3-88e2-6dd3bd2c881d). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.
== Screenshots ==
1. The Polylang languages admin panel
2. The Strings translations admin panel
3. Multilingual media library
4. The Edit Post screen with the Languages metabox
== Changelog ==
= 3.8.3 (2026-04-27) =
* Pro: Improve performance of the languages sidebar in the block editor #2989
* Pro: Fix impossibility to add more than one translation at once from the block editor sidebar #2985
* Pro: Fix HTML entities displayed in translation inputs in the block editor sidebar #2984
* Pro: Fix error when editing a pattern from the post editor #2990
* Pro: Fix sync icon incorrectly shown as active on new posts #2995
* Pro: Fix `pll_sync_post` REST API field returning an empty array instead of an ampty object #2995
* Pro: Fix ACF fields in a repeater nested in a flexible content overwritten with wrong values #2975
* Fix language switcher block error in Widget screen #1856
* Fix PHP warning in site health #1862
* Fix wrong cookie sent in some cases #1863
* Fix error with WordPress Importer when the imported file has synchronized posts #1853
= 3.8.2 (2026-04-07) =
* Pro: Fix refresh issues in block editor languages panel #2965
* Pro: Fix error when unlinking 2 translations in block editor #2970
* Pro: Fix fatal error when a repeater is previously created in ACF Pro but ACF is active #2972
* Fix settings redirect in Playground #1840
* Fix possible fatal error when the default language has been corrupted in DB #1843
= 3.8.1 (2026-03-19) =
* Fix fatal error when the cache is suspended #1837 #1839
= 3.8 (2026-03-17) =
* Requires PHP 7.4 and WP 6.5 as minimum version
* Pro: Use autonomous updater #2475
* Pro: Add capabilities allowing to control permissions per language
* Pro: Add capabilities to control access to languages and strings translations
* Pro: Allow to manage languages and settings with WP CLI #2653
* Pro: Add smart duplication in site editor #2559
* Pro: Add support for DeepL glossaries #2687
* Pro: Add locale fallback support to machine translation #2685
* Pro: Add Support encoding for block attributes in wpml-config.xml #1683, #2660
* Pro: Improve extensibility of the block editor languages panel #2553
* Pro: Add support for new blocks introduced in WP 7.0 #2933 #2941
* Pro: Hide language selector on inner blocks in Widget Block Editor #2900
* Pro: Fix page template not copied when creating a new page translation in the block editor #2581
* Pro: Fix SVG icons lost when using machine translation
* Pro: Fix a performance issue with the translation of ACF labels #2670
* Pro: Fix product status wrongly modified when updating a product with the REST API #2540
* Pro: Fix inactive languages not displayed when they should in REST API #2791
* Pro: Fix translation of ACF repeaters with pagination #2674
* Pro: Fix ACF's layout fields instructions #2889
* Pro: Fix ACF's taxonomy fields not synchronized #2948
* Pro: Fix event dates of The Events Calendar not duplicated #2894
* Add language switcher block and navigation language switcher block #1811
* Add support for multiple encodings in wpml-config.xml #1679, #2655
* Enforce transients in DB and in object cache are synchronized #1653, #2598
* Enforce passing all translations when saving the translations of a post or term #1690
* Hide the admin language filter when editing posts #1698
* Improve performance by preventing DB queries to fetch the language terms #1650
* Fix edge cases where the translation group could be corrupted #1690
* Fix a fatal error on multisite when saving a post after having switched to a site without Polylang #1700
* Fix a fatal error when translating a custom table #1730
* Fix warning when requesting a non-existing language #1665
* Fix strings translations import with WP Importer #1637
* Fix edge cases leading to wrong languages order #1777
* Fix a fatal error with the plugin Groups #1834
See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog
@@ -0,0 +1,41 @@
<?php
/**
* @package Polylang
*/
namespace WP_Syntex\Polylang_Pro\Options\Business;
use WP_Syntex\Polylang\Options\Primitive\Abstract_Boolean;
defined( 'ABSPATH' ) || exit;
/**
* Class defining machine translation boolean option.
*
* @since 3.7
*/
class Machine_Translation_Enabled extends Abstract_Boolean {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_enabled'
*/
public static function key(): string {
return 'machine_translation_enabled';
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Enable machine translation.', 'polylang-pro' );
}
}
@@ -0,0 +1,167 @@
<?php
/**
* @package Polylang
*/
namespace WP_Syntex\Polylang_Pro\Options\Business;
use WP_Error;
use WP_Syntex\Polylang\Options\Options;
use WP_Syntex\Polylang\Options\Abstract_Option;
use WP_Syntex\Polylang_Pro\Modules\Machine_Translation\Factory;
use WP_Syntex\Polylang_Pro\Modules\Machine_Translation\Services\Deepl as Service;
defined( 'ABSPATH' ) || exit;
/**
* Class defining machine translation services array option.
*
* @since 3.7
*
* @phpstan-import-type DeeplOptions from \WP_Syntex\Polylang_Pro\Modules\Machine_Translation\Services\Deepl
*/
class Machine_Translation_Services extends Abstract_Option {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'machine_translation_services'
*/
public static function key(): string {
return 'machine_translation_services';
}
/**
* Sanitizes option's value.
* Can populate the `$errors` property with blocking and non-blocking errors: in case of non-blocking errors,
* the value is sanitized and can be stored.
*
* @since 3.8
*
* @param array $value Value to sanitize.
* @param Options $options All options.
* @return array|WP_Error The sanitized value. An instance of `WP_Error` in case of blocking error.
*
* @phpstan-return array{deepl: DeeplOptions}|WP_Error
*/
protected function sanitize( $value, Options $options ) {
$value = parent::sanitize( $value, $options );
if ( is_wp_error( $value ) ) {
return $value;
}
/** @var array{deepl: DeeplOptions} $value */
if ( empty( $value['deepl']['api_key'] ) ) {
// Reset the glossary ID if the API key is empty.
$value['deepl']['glossary_id'] = '';
}
return $value;
}
/**
* Adds information to the site health info array.
*
* @since 3.8
*
* @param Options $options An instance of the Options class providing additional configuration.
*
* @return array The updated site health information.
*/
public function get_site_health_info( Options $options ): array { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
/**
* @var array{deepl: DeeplOptions} $value
*/
$value = $this->get();
if ( empty( $value['deepl']['api_key'] ) ) {
return $this->format_single_value_for_site_health_info( __( 'DeepL is activated but no API key is set.', 'polylang-pro' ) );
}
$service = new Service(
array(
'api_key' => $value['deepl']['api_key'],
'formality' => $value['deepl']['formality'] ?? null,
),
PLL()->model
);
$result = $service->get_client()->is_api_key_valid();
if ( $result->has_errors() ) {
return $this->format_single_value_for_site_health_info( $result->get_error_message() );
}
return $this->format_single_value_for_site_health_info( __( 'The API key is valid', 'polylang-pro' ) );
}
/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default() {
$services = array();
foreach ( Factory::get_classnames() as $service ) {
$services[ $service::get_slug() ] = array();
}
return $services;
}
/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array<
* non-falsy-string,
* array{
* type: 'object',
* properties: array,
* additionalProperties: false
* }
* >,
* additionalProperties: false
* }
*/
protected function get_data_structure(): array {
$structure = array(
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => array(),
'additionalProperties' => false,
);
foreach ( Factory::get_classnames() as $service ) {
$structure['properties'][ $service::get_slug() ] = array(
'type' => 'object',
'properties' => $service::get_option_schema(),
'additionalProperties' => false,
);
}
return $structure;
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Settings for machine translation services: DeepL\'s API key, formality, and glossary for now.', 'polylang-pro' );
}
}
@@ -0,0 +1,107 @@
<?php
/**
* @package Polylang
*/
namespace WP_Syntex\Polylang_Pro\Options\Business;
use WP_Syntex\Polylang\Options\Abstract_Option;
use WP_Syntex\Polylang\Options\Options;
defined( 'ABSPATH' ) || exit;
/**
* Class defining media array option.
*
* @since 3.7
*/
class Media extends Abstract_Option {
/**
* Returns option key.
*
* @since 3.7
*
* @return string
*
* @phpstan-return 'media'
*/
public static function key(): string {
return 'media';
}
/**
* Returns the default value.
*
* @since 3.7
*
* @return array
*/
protected function get_default() {
return array( 'duplicate' => false );
}
/**
* Adds information to the site health info array.
*
* @since 3.8
*
* @param Options $options An instance of the Options class providing additional configuration.
*
* @return array The updated site health information.
*/
public function get_site_health_info( Options $options ): array { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$key = self::key();
$fields = array();
/** @var array<string, mixed> $value */
$value = $this->get();
foreach ( $value as $sub_key => $sub_value ) {
if ( $sub_value ) {
$fields[ "$key-$sub_key" ] = __( 'Enabled', 'polylang-pro' );
}
}
return $this->format_single_value_for_site_health_info( $this->format_array_for_site_health_info( $fields ) );
}
/**
* Returns the JSON schema part specific to this option.
*
* @since 3.7
*
* @return array Partial schema.
*
* @phpstan-return array{
* type: 'object',
* properties: array{
* duplicate: array{
* type: 'boolean',
* required: true
* }
* },
* additionalProperties: false
* }
*/
protected function get_data_structure(): array {
return array(
'type' => 'object', // Correspond to associative array in PHP, @see{https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#primitive-types}.
'properties' => array(
'duplicate' => array(
'type' => 'boolean',
'required' => true,
),
),
'additionalProperties' => false,
);
}
/**
* Returns the description used in the JSON schema.
*
* @since 3.7
*
* @return string
*/
protected function get_description(): string {
return __( 'Automatically duplicate media in all languages when uploading a new file.', 'polylang-pro' );
}
}

Some files were not shown because too many files have changed in this diff Show More