Commit 4f4170b9 authored by Simonas's avatar Simonas

Merge branch 'database-update' into dev

parents d94d49c9 ba65c02a
......@@ -17,10 +17,10 @@
- check if dev.biuro.lt, dev.biuro.lv, dev.biuro.ee works
### DB backup
- `C:\web\dev.biuro> docker exec -i mysql mysqldump -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress > docker/mariadb/db_008.sql`
- `C:\web\dev.biuro> docker exec -i mysql mysqldump -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress > docker/mariadb/db_009.sql`
### DB restore
- `C:\web\dev.biuro> docker exec -i mysql mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress < docker/mariadb/db_007.sql`
- `C:\web\dev.biuro> docker exec -i mysql mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress < docker/mariadb/db_008.sql`
## Development
- `C:\web\dev.biuro\wordpress>npm install`
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,8 +15,42 @@
get_header(); ?>
<?php
// $slug = pods_v( 'last', 'url' );
// echo '<p><b>slug:</b> ' . $slug . '</p>';
// //get pods object for current item
// $pods = pods( 'job' );
// debug( $pods->data() );
// $jobs = new WP_Query( array( 'post_type' => 'job' ) );
if ( $jobs->have_posts() ) :
while ( $jobs->have_posts() ) :
echo '<h1>Lorem ipsum</h1>';
debug( $jobs->the_post() );
endwhile;
endif;
wp_reset_query();
// $jobs = new WP_Query( array( 'post_type' => 'job' ) );
// debug( $jobs->posts );
// foreach ( $jobs->posts as $key=> $job ) {
// echo '<p>' . get_the_terms( $job, 'city' ) . '</p>';
// }
while ( have_posts() ) :
the_post();
the_content();
......
......@@ -15,10 +15,12 @@
// debug( ( 'where' ) );
//get current item
$slug = pods_var( 'last', 'url' );
//get pods object for current item
$pods = pods( 'job', $slug );
// $slug = pods_v( 'last', 'url' );
debug( $pods->fetch() );
// echo '<p><b>slug:</b> ' . $slug . '</p>';
// //get pods object for current item
// $pods = pods( 'job' );
// debug( $pods->data() );
?>
......@@ -17,7 +17,6 @@
get_header(); ?>
<?php
if (get_post_type( get_the_ID() ) == 'job'):
?>
......
......@@ -212,7 +212,7 @@ class PLL_Admin_Filters extends PLL_Filters {
public function sanitize_title( $title, $raw_title, $context ) {
static $once = false;
if ( ! $once && 'save' == $context && ! empty( $this->curlang ) && ! empty( $title ) ) {
if ( ! $once && 'save' == $context && ! empty( $title ) ) {
$once = true;
add_filter( 'locale', array( $this, 'get_locale' ), 20 ); // After the filter for the admin interface
$title = sanitize_title( $raw_title, '', $context );
......@@ -235,7 +235,7 @@ class PLL_Admin_Filters extends PLL_Filters {
public function sanitize_user( $username, $raw_username, $strict ) {
static $once = false;
if ( ! $once && ! empty( $this->curlang ) ) {
if ( ! $once ) {
$once = true;
add_filter( 'locale', array( $this, 'get_locale' ), 20 ); // After the filter for the admin interface
$username = sanitize_user( $raw_username, '', $strict );
......
......@@ -2,6 +2,131 @@
This file contains only old changelog. See readme.txt for newer versions.
= 2.3.11 (2018-10-03) =
* Pro: Add action 'pll_created_sync_post'
* Pro: Fix language and translations not included for tags in the REST API
* Fix Assigning a parent category breaking the hierarchy of translated category
= 2.3.10 (2018-08-16) =
* Fix Lingotek notice not dismissable
* Fix fatal error with the widget calendar
= 2.3.9 (2018-08-14) =
* Add a notice to inform about Polylang for WooCommerce
* Deprecate PLL_Pointer
* Fix bulk editing pages with no language breaking hierarchy #281
* Fix an edge case where rewrite rules could be messed on a multisite
* MU Domain Mapping: fix secondary domain redirected to primary domain
= 2.3.8 (2018-07-16) =
* Pro: Duplicate term meta when duplicating a post creates new terms
* Pro: Add compatibility with ACF Pro when it's bundled with the theme
* Pro: Fix a fatal error when duplicating posts
* Set cookie during the home redirect
* Accept a port in the url to detect the site home
* Add filter 'pll_is_cache_active' to allow to load the cache compatibility #270 #274
* Fix potential fatal error when a 3rd party misuses the 'wpml_active_languages' filter #268
* Fix Uncaught TypeError: s.split is not a function. Props Wouter Van Vliet #262
* Fix text alignment for RTL scripts in Lingotek panel #247
* Fix html language attribute filter on admin
* Fix cookie expiration time when set in js. Props Jens Nachtigall #271
* Fix fatal error when a 3rd party misuses the WP_Query tax_query param. Props JanneAalto #252
* Fix an edge case which could mess home pages on a multisite
= 2.3.7 (2018-06-07) =
* Pro: The Events Calendar: Fix untranslated events shown in all languages
* Avoid displaying edit links of translations of the privacy policy page to non-admin
* Fix draft created when creating a new page on multisite
* Do not prevent using the cache for home when using WP Rocket 3.0.5 or later #236
* Fix language filter applied to wrong queries on admin side
= 2.3.6 (2018-05-17) =
* Pro: Fix post type archive slug not translated in ACF page link fields
* WP 4.9.6: Translate the privacy policy page
* WP 4.9.6: Add the translated user descriptions to exported personal data
* Update Plugin updater to version 1.6.16
* Fix conflict with the plugin View Admin As. Props Jory Hogeveen. #253
= 2.3.5 (2018-05-08) =
* Pro: Fix translated CPT slugs when one CPT name is a substring of another one. Props Steve Reimer.
* Pro: Fix canonical redirection for post types archives when the CPT slug is translated
* Pro: Fix ACF private key uselessly synchronized when the public custom field is not synchronized
* Add filter 'pll_filter_query_excluded_query_vars'
* Redirect www. to non www. when using multiple domains
* Fix Yoast SEO category sitemap not filtered by language when using multiple domains
* Fix PLL_COOKIE === false not honored when using a cache plugin. #248
* Fix empty predefined languages list
= 2.3.4 (2018-03-27) =
* Pro: Fix conflict with Pods related to translated slugs for custom post types
* Add Friulian to the predefined languages list
* Fix conflict (javascript error) with Gütenberg #225
* Fix conflict on ajax requests introduced by WooCoommerce 3.3.4
* Fix queries by 'category_name' not auto translated #238
= 2.3.3 (2018-03-15) =
* Pro: Fix tax query using a term sharing slugs (fix a conflict with Fusion Builder)
* Restore Polylang (free) on REST requests, while disabling the language filter as in v2.3
* Rework auto translated query with taxonomy in different language #223
* Synchronize Yoast SEO primary category (needs Yoast SEO 7.0+)
* Fix PHP warning introduced by Yoast SEO 7.0 #229
* Fix tax query when using the relation 'OR'
* Fix a conflict with the combination of Barrel + WP Bakery Page Builder
* Fix broken redirect with MU domain mapping #226
* Fix site title not translated in password change email
= 2.3.2 (2018-03-05) =
* Pro: Fix REST requests not filtered by the requested language (introduced in 2.3).
* Pro: Fix error 404 on single posts if posts are untranslatable
* Deactivate Polylang (free) on REST requests by default.
* Fix translated terms unassigned from posts when deleting a term
* Fix auto translated query with taxonomy in different language returning empty results since WP 4.9 #223
* Fix conflict with a homepage option of the theme Extra
* Fix warning when filtering get_pages()
= 2.3.1 (2018-02-15) =
* Pro: Fix GET REST request with slug parameter deleting the post slug
* Fix http request with a custom query var being redirected to the home page #216
= 2.3 (2018-01-30) =
* Pro: Duplicating a post now duplicates untranslated terms and the featured image (if media are translatable)
* Pro: Add filter 'pll_sync_post_fields'
* Pro: Translate ACF Pro clone fields when creating a new field group translation
* Pro: Allow to share slugs when creating a post or term with the REST API
* Pro: Load asynchronously the script added on front for multiple domains and subdomains
* Pro: Fix 'lang' parameter not interpreted when the query includes 'name'
* Refactor the synchronization of metas for better synchronization and performance improvement
* Refactor the synchronization of taxonomy terms for performance improvement
* Refactor language and translations saving for performance improvement
* Refactor the synchronization of sticky posts
* Remove all languages files. All translations are now maintained on https://translate.wordpress.org/projects/wp-plugins/polylang #199
* Refactor the list of languages to merge predefined languages, Facebook locales and fixes for W3C locales
* Automatically deactivate Polylang when activating Polylang Pro
* Disable programmatically translated post types and taxonomies in settings. Props Ulrich Pogson. #180
* Set the cookie language in Javascript when a cache plugin is active
* Automatically remove the home page from cache when requesting the detection of the browser preferred language
* Use relative urls for the admin language filter in admin bar. #209
* Disable auto translation of WP_Term_Query if it has a 'lang' parameter
* Don't filter REST requests by default. #211
* Fix Yoast SEO statistics in dashboard showing only the default language. #211
* Fix WP Rocket clearing the cache of the wrong adjacent post
* Fix random header image
* Fix home page not correctly loaded when adding a query var
* Fix: Impossible to change the language code when the language code is also a WordPress locale.
= 2.2.8 (2018-01-09) =
* Pro: Fix: Impossible to link past events by translation in The Events Calendar
......
......@@ -82,7 +82,8 @@ class PLL_Frontend_Filters extends PLL_Filters {
public function option_sticky_posts( $posts ) {
global $wpdb;
if ( $this->curlang && ! empty( $posts ) ) {
// Do not filter sticky posts on REST requests as $this->curlang is *not* the 'lang' parameter set in the request
if ( ! defined( 'REST_REQUEST' ) && $this->curlang && ! empty( $posts ) ) {
$_posts = wp_cache_get( 'sticky_posts', 'options' ); // This option is usually cached in 'all_options' by WP
if ( empty( $_posts ) || ! is_array( $_posts[ $this->curlang->term_taxonomy_id ] ) ) {
......@@ -145,6 +146,7 @@ class PLL_Frontend_Filters extends PLL_Filters {
* @return bool|array false if we hide the widget, unmodified $instance otherwise
*/
public function widget_display_callback( $instance, $widget ) {
// FIXME it looks like this filter is useless, now the we use the filter sidebars_widgets
return ! empty( $instance['pll_lang'] ) && $instance['pll_lang'] != $this->curlang->slug ? false : $instance;
}
......@@ -161,7 +163,12 @@ class PLL_Frontend_Filters extends PLL_Filters {
public function sidebars_widgets( $sidebars_widgets ) {
global $wp_registered_widgets;
$_sidebars_widgets = $this->cache->get( 'sidebars_widgets' );
if ( empty( $wp_registered_widgets ) ) {
return $sidebars_widgets;
}
$cache_key = md5( serialize( $sidebars_widgets ) );
$_sidebars_widgets = $this->cache->get( "sidebars_widgets_{$cache_key}" );
if ( false !== $_sidebars_widgets ) {
return $_sidebars_widgets;
......@@ -189,7 +196,7 @@ class PLL_Frontend_Filters extends PLL_Filters {
}
}
$this->cache->set( 'sidebars_widgets', $sidebars_widgets );
$this->cache->set( "sidebars_widgets_{$cache_key}", $sidebars_widgets );
return $sidebars_widgets;
}
......
......@@ -51,6 +51,28 @@ class PLL_Frontend extends PLL_Base {
}
}
/**
* Is the current request a REST API request?
* Inspired by WP::parse_request()
* Needed because at this point, the constant REST_REQUEST is not defined yet
*
* @since 2.4.1
*
* @return bool
*/
public function is_rest_request() {
$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
$req_uri = trim( $_SERVER['REQUEST_URI'], '/' );
$req_uri = preg_replace( $home_path_regex, '', $req_uri );
$req_uri = trim( $req_uri, '/' );
$req_uri = str_replace( 'index.php', '', $req_uri );
$req_uri = trim( $req_uri, '/' );
return 0 === strpos( $req_uri, rest_get_url_prefix() . '/' );
}
/**
* Setups the language chooser based on options
*
......@@ -60,7 +82,7 @@ class PLL_Frontend extends PLL_Base {
$this->links = new PLL_Frontend_Links( $this );
// Don't set any language for REST requests when Polylang Pro is not active
if ( ! class_exists( 'PLL_REST_Translated_Object' ) && 0 === strpos( str_replace( 'index.php', '', $_SERVER['REQUEST_URI'] ), '/' . rest_get_url_prefix() . '/' ) ) {
if ( ! class_exists( 'PLL_REST_Translated_Object' ) && $this->is_rest_request() ) {
/** This action is documented in include/class-polylang.php */
do_action( 'pll_no_language_defined' );
} else {
......
......@@ -116,7 +116,7 @@ if ( ! function_exists( 'icl_link_to_element' ) ) {
}
$pll_type = ( 'post' == $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' == $type || pll_is_translated_taxonomy( $type ) ? 'term' : false );
if ( $pll_type && ( $lang = pll_current_language() ) && ( $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang ) ) && PLL()->links->current_user_can_read( $tr_id ) ) {
if ( $pll_type && ( $lang = pll_current_language() ) && ( $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang ) ) && ( 'term' === $pll_type || PLL()->links->current_user_can_read( $tr_id ) ) ) {
$id = $tr_id;
} elseif ( ! $return_original_if_missing ) {
return '';
......
......@@ -3,7 +3,7 @@
/**
Plugin Name: Polylang
Plugin URI: https://polylang.pro
Version: 2.4
Version: 2.4.1
Author: Frédéric Demarle
Author uri: https://polylang.pro
Description: Adds multilingual capability to WordPress
......@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
}
} else {
// Go on loading the plugin
define( 'POLYLANG_VERSION', '2.4' );
define( 'POLYLANG_VERSION', '2.4.1' );
define( 'PLL_MIN_WP_VERSION', '4.7' );
define( 'POLYLANG_FILE', __FILE__ ); // this file
......
......@@ -4,7 +4,7 @@ Donate link: https://polylang.pro
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
Requires at least: 4.7
Tested up to: 4.9
Stable tag: 2.4
Stable tag: 2.4.1
License: GPLv2 or later
Making WordPress multilingual
......@@ -76,6 +76,17 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
== Changelog ==
= 2.4.1 (2018-11-27) =
* Pro: Add compatibility with REST API changes made in WP 5.0
* Pro: Fix sticky posts in the REST API
* Pro: Fix overwritten custom post slug when the post is updated with the REST API
* Pro: Fix bulk translate for media
* Fix a conflict with Custom sidebars and Content aware sidebars
* Fix a conflict with the theme Pokemania
* Fix PHP notices when using the function 'icl_link_to_element' for terms
* Fix title slugs for posts written in German
= 2.4 (2018-11-12) =
* Minimum WordPress version is now 4.7
......@@ -87,7 +98,7 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
* Pro: Fix term not duplicated correctly when the language is set from the content
* Refactor the core to activate on front and for the REST api actions that were previously available only in the backend (language checks, synchronizations...).
* Add flags to widgets displayed in only one language (Props Jory Hogeveen) #257
* Honor 'pll_the_language_args' for all options in menus #237
* Honor the filter 'pll_the_language_args' for all options in menus #237
* Add better filters for default flags and custom flags
* Custom flags can now be stored in the polylang directory in the theme
* Custom flags can now use SVG
......@@ -99,129 +110,4 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
* Fix performance issue when using hundreds of widgets
* Fix translations possibly wrong if the post language is changed without saving the post after
= 2.3.11 (2018-10-03) =
* Pro: Add action 'pll_created_sync_post'
* Pro: Fix language and translations not included for tags in the REST API
* Fix Assigning a parent category breaking the hierarchy of translated category
= 2.3.10 (2018-08-16) =
* Fix Lingotek notice not dismissable
* Fix fatal error with the widget calendar
= 2.3.9 (2018-08-14) =
* Add a notice to inform about Polylang for WooCommerce
* Deprecate PLL_Pointer
* Fix bulk editing pages with no language breaking hierarchy #281
* Fix an edge case where rewrite rules could be messed on a multisite
* MU Domain Mapping: fix secondary domain redirected to primary domain
= 2.3.8 (2018-07-16) =
* Pro: Duplicate term meta when duplicating a post creates new terms
* Pro: Add compatibility with ACF Pro when it's bundled with the theme
* Pro: Fix a fatal error when duplicating posts
* Set cookie during the home redirect
* Accept a port in the url to detect the site home
* Add filter 'pll_is_cache_active' to allow to load the cache compatibility #270 #274
* Fix potential fatal error when a 3rd party misuses the 'wpml_active_languages' filter #268
* Fix Uncaught TypeError: s.split is not a function. Props Wouter Van Vliet #262
* Fix text alignment for RTL scripts in Lingotek panel #247
* Fix html language attribute filter on admin
* Fix cookie expiration time when set in js. Props Jens Nachtigall #271
* Fix fatal error when a 3rd party misuses the WP_Query tax_query param. Props JanneAalto #252
* Fix an edge case which could mess home pages on a multisite
= 2.3.7 (2018-06-07) =
* Pro: The Events Calendar: Fix untranslated events shown in all languages
* Avoid displaying edit links of translations of the privacy policy page to non-admin
* Fix draft created when creating a new page on multisite
* Do not prevent using the cache for home when using WP Rocket 3.0.5 or later #236
* Fix language filter applied to wrong queries on admin side
= 2.3.6 (2018-05-17) =
* Pro: Fix post type archive slug not translated in ACF page link fields
* WP 4.9.6: Translate the privacy policy page
* WP 4.9.6: Add the translated user descriptions to exported personal data
* Update Plugin updater to version 1.6.16
* Fix conflict with the plugin View Admin As. Props Jory Hogeveen. #253
= 2.3.5 (2018-05-08) =
* Pro: Fix translated CPT slugs when one CPT name is a substring of another one. Props Steve Reimer.
* Pro: Fix canonical redirection for post types archives when the CPT slug is translated
* Pro: Fix ACF private key uselessly synchronized when the public custom field is not synchronized
* Add filter 'pll_filter_query_excluded_query_vars'
* Redirect www. to non www. when using multiple domains
* Fix Yoast SEO category sitemap not filtered by language when using multiple domains
* Fix PLL_COOKIE === false not honored when using a cache plugin. #248
* Fix empty predefined languages list
= 2.3.4 (2018-03-27) =
* Pro: Fix conflict with Pods related to translated slugs for custom post types
* Add Friulian to the predefined languages list
* Fix conflict (javascript error) with Gütenberg #225
* Fix conflict on ajax requests introduced by WooCoommerce 3.3.4
* Fix queries by 'category_name' not auto translated #238
= 2.3.3 (2018-03-15) =
* Pro: Fix tax query using a term sharing slugs (fix a conflict with Fusion Builder)
* Restore Polylang (free) on REST requests, while disabling the language filter as in v2.3
* Rework auto translated query with taxonomy in different language #223
* Synchronize Yoast SEO primary category (needs Yoast SEO 7.0+)
* Fix PHP warning introduced by Yoast SEO 7.0 #229
* Fix tax query when using the relation 'OR'
* Fix a conflict with the combination of Barrel + WP Bakery Page Builder
* Fix broken redirect with MU domain mapping #226
* Fix site title not translated in password change email
= 2.3.2 (2018-03-05) =
* Pro: Fix REST requests not filtered by the requested language (introduced in 2.3).
* Pro: Fix error 404 on single posts if posts are untranslatable
* Deactivate Polylang (free) on REST requests by default.
* Fix translated terms unassigned from posts when deleting a term
* Fix auto translated query with taxonomy in different language returning empty results since WP 4.9 #223
* Fix conflict with a homepage option of the theme Extra
* Fix warning when filtering get_pages()
= 2.3.1 (2018-02-15) =
* Pro: Fix GET REST request with slug parameter deleting the post slug
* Fix http request with a custom query var being redirected to the home page #216
= 2.3 (2018-01-30) =
* Pro: Duplicating a post now duplicates untranslated terms and the featured image (if media are translatable)
* Pro: Add filter 'pll_sync_post_fields'
* Pro: Translate ACF Pro clone fields when creating a new field group translation
* Pro: Allow to share slugs when creating a post or term with the REST API
* Pro: Load asynchronously the script added on front for multiple domains and subdomains
* Pro: Fix 'lang' parameter not interpreted when the query includes 'name'
* Refactor the synchronization of metas for better synchronization and performance improvement
* Refactor the synchronization of taxonomy terms for performance improvement
* Refactor language and translations saving for performance improvement
* Refactor the synchronization of sticky posts
* Remove all languages files. All translations are now maintained on https://translate.wordpress.org/projects/wp-plugins/polylang #199
* Refactor the list of languages to merge predefined languages, Facebook locales and fixes for W3C locales
* Automatically deactivate Polylang when activating Polylang Pro
* Disable programmatically translated post types and taxonomies in settings. Props Ulrich Pogson. #180
* Set the cookie language in Javascript when a cache plugin is active
* Automatically remove the home page from cache when requesting the detection of the browser preferred language
* Use relative urls for the admin language filter in admin bar. #209
* Disable auto translation of WP_Term_Query if it has a 'lang' parameter
* Don't filter REST requests by default. #211
* Fix Yoast SEO statistics in dashboard showing only the default language. #211
* Fix WP Rocket clearing the cache of the wrong adjacent post
* Fix random header image
* Fix home page not correctly loaded when adding a query var
* Fix: Impossible to change the language code when the language code is also a WordPress locale.
See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog
......@@ -15,8 +15,42 @@
get_header(); ?>
<?php
// $slug = pods_v( 'last', 'url' );
// echo '<p><b>slug:</b> ' . $slug . '</p>';
// //get pods object for current item
// $pods = pods( 'job' );
// debug( $pods->data() );
// $jobs = new WP_Query( array( 'post_type' => 'job' ) );
if ( $jobs->have_posts() ) :
while ( $jobs->have_posts() ) :
echo '<h1>Lorem ipsum</h1>';
debug( $jobs->the_post() );
endwhile;
endif;
wp_reset_query();
// $jobs = new WP_Query( array( 'post_type' => 'job' ) );
// debug( $jobs->posts );
// foreach ( $jobs->posts as $key=> $job ) {
// echo '<p>' . get_the_terms( $job, 'city' ) . '</p>';
// }
while ( have_posts() ) :
the_post();
the_content();
......
......@@ -15,10 +15,12 @@
// debug( ( 'where' ) );
//get current item
$slug = pods_var( 'last', 'url' );
//get pods object for current item
$pods = pods( 'job', $slug );
// $slug = pods_v( 'last', 'url' );
debug( $pods->fetch() );
// echo '<p><b>slug:</b> ' . $slug . '</p>';
// //get pods object for current item
// $pods = pods( 'job' );
// debug( $pods->data() );
?>
......@@ -17,7 +17,6 @@
get_header(); ?>
<?php
if (get_post_type( get_the_ID() ) == 'job'):
?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment