Merge tag '0.18.8' into develop

release 0.18.8
This commit is contained in:
vnmedeiros 2022-01-28 17:24:47 -03:00
commit f0315b0d1c
25 changed files with 91 additions and 39 deletions

View File

@ -133,6 +133,8 @@
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container a:hover { .wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container a:hover {
color: inherit; color: inherit;
text-decoration: none; } text-decoration: none; }
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide-duplicate img {
display: initial !important; }
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid a { .wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid a {
width: 100%; width: 100%;
display: block; } display: block; }

File diff suppressed because one or more lines are too long

View File

@ -440,6 +440,8 @@
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 { .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-6, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-5, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-4, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-3, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-2, .wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item.max-itens-per-screen-1 {
width: calc(100% - var(--spaceBetweenItems, 32px) ); width: calc(100% - var(--spaceBetweenItems, 32px) );
min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } } min-width: calc(100% - var(--spaceBetweenItems, 32px) ); } }
.wp-block-tainacan-carousel-items-list .swiper-slide-duplicate img {
display: initial !important; }
.block-editor-block-list__block > .wp-block-tainacan-carousel-items-list { .block-editor-block-list__block > .wp-block-tainacan-carousel-items-list {
max-width: calc(100% - 72px); } max-width: calc(100% - 72px); }

File diff suppressed because one or more lines are too long

View File

@ -133,6 +133,8 @@
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a:hover { .wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a:hover {
color: inherit; color: inherit;
text-decoration: none; } text-decoration: none; }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide-duplicate img {
display: initial !important; }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid a { .wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid a {
width: 100%; width: 100%;
display: block; } display: block; }

File diff suppressed because one or more lines are too long

View File

@ -884,7 +884,8 @@ a.pswp__share--download:hover {
align-items: center; align-items: center;
text-align: center; text-align: center;
padding: 44px; padding: 44px;
margin-top: 22px; } margin-top: 22px;
margin-bottom: 22px; }
.tainacan-photoswipe-layer .pswp__container .attachment-without-image > iframe:not(.wp-embedded-content) { .tainacan-photoswipe-layer .pswp__container .attachment-without-image > iframe:not(.wp-embedded-content) {
width: 90vw; width: 90vw;
height: 90vh; height: 90vh;
@ -903,6 +904,10 @@ a.pswp__share--download:hover {
background-image: url("../images/preloader.gif"); background-image: url("../images/preloader.gif");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; } background-position: center; }
.tainacan-photoswipe-layer .pswp__container .pswp__zoom-wrap {
display: flex;
justify-content: center;
align-items: center; }
.tainacan-photoswipe-layer .pswp__container .tainacan-content-embed { .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed {
width: 100%; width: 100%;
height: auto; } height: auto; }
@ -936,9 +941,12 @@ a.pswp__share--download:hover {
.tainacan-photoswipe-layer .pswp__container audio { .tainacan-photoswipe-layer .pswp__container audio {
background: black; background: black;
min-height: 38px; min-height: 38px;
border-radius: 20px; } border-radius: 20px;
min-width: 80%;
max-width: 80%; }
.tainacan-photoswipe-layer .pswp__container video { .tainacan-photoswipe-layer .pswp__container video {
min-height: 56px; } min-height: 56px;
max-width: 80%; }
.tainacan-photoswipe-layer .pswp__top-bar .pswp__name { .tainacan-photoswipe-layer .pswp__top-bar .pswp__name {
color: white; color: white;
text-align: center; text-align: center;

File diff suppressed because one or more lines are too long

View File

@ -228,8 +228,8 @@ class REST_Controller extends \WP_REST_Controller {
foreach ( $request_meta_query as $index1 => $a ) { foreach ( $request_meta_query as $index1 => $a ) {
foreach ( $query as $mapped_meta => $meta_v ) { foreach ( $query as $mapped_meta => $meta_v ) {
if ( isset( $a[ $meta_v ] ) ) { if ( isset( $a[ $mapped_meta ] ) ) {
$args[ $mapped_v ][ $index1 ][ $meta_v ] = $request[ $mapped ][ $index1 ][ $meta_v ]; $args[ $mapped_v ][ $index1 ][ $meta_v ] = $request[ $mapped ][ $index1 ][ $mapped_meta ];
} }
} }
@ -237,8 +237,8 @@ class REST_Controller extends \WP_REST_Controller {
} else { } else {
foreach ( $query as $mapped_meta => $meta_v ) { foreach ( $query as $mapped_meta => $meta_v ) {
if(isset($request[$mapped][$meta_v])) { if(isset($request[$mapped][$mapped_meta])) {
$args[ $mapped_v ][ $meta_v ] = $request[ $mapped ][ $meta_v ]; $args[ $mapped_v ][ $meta_v ] = $request[ $mapped ][ $mapped_meta ];
} }
} }
} }

View File

@ -71,8 +71,8 @@ class Elastic_Press {
$array_must_nested = $el_must['bool']['must']; $array_must_nested = $el_must['bool']['must'];
for($j = 0; $j < count($array_must_nested); $j++ ) { for($j = 0; $j < count($array_must_nested); $j++ ) {
if ( isset ($array_must_nested[$j]['match_phrase'] ) ) { if ( isset ($array_must_nested[$j]['match_phrase'] ) ) {
$formatted_args['post_filter']['bool']['must'][$i]['bool']['must'][$j]['wildcard'] = $formatted_args['post_filter']['bool']['must'][$i]['bool']['must'][$j]['match_phrase_prefix'] =
array_map( function($match) { return "*$match*"; } ,$array_must_nested[$j]['match_phrase']); array_map( function($match) { return "$match"; } ,$array_must_nested[$j]['match_phrase']);
unset($formatted_args['post_filter']['bool']['must'][$i]['bool']['must'][$j]['match_phrase']); unset($formatted_args['post_filter']['bool']['must'][$i]['bool']['must'][$j]['match_phrase']);
} }
} }

View File

@ -143,7 +143,9 @@ class Embed {
$width = false; $width = false;
$dom = new \DOMDocument(); $dom = new \DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html); $dom->loadHTML($html);
libxml_clear_errors();
// If we have a fixed aspect iframe, and it's a responsive embed content. // If we have a fixed aspect iframe, and it's a responsive embed content.
if ($dom) { if ($dom) {

View File

@ -221,12 +221,13 @@ class Media {
function get_mime_content_type( $filename ){ function get_mime_content_type( $filename ){
if (function_exists( 'mime_content_type' )) { if (function_exists( 'mime_content_type' )) {
return mime_content_type($filename); return mime_content_type($filename);
} else { } else if( function_exists( 'finfo_open' ) ) {
$finfo = finfo_open( FILEINFO_MIME_TYPE ); $finfo = finfo_open( FILEINFO_MIME_TYPE );
$mime_type = finfo_file( $finfo, $filename ); $mime_type = finfo_file( $finfo, $filename );
finfo_close( $finfo ); finfo_close( $finfo );
return $mime_type; return $mime_type;
} }
return '';
} }
/** /**

View File

@ -353,7 +353,7 @@ class Items extends Repository {
$args = apply_filters( 'tainacan_fetch_args', $args, 'items' ); $args = apply_filters( 'tainacan_fetch_args', $args, 'items' );
$should_filter = is_user_logged_in() && ! isset($args['post_status']) && sizeof($cpt) > 1; $should_filter = is_user_logged_in() && sizeof($cpt) > 1;
if ( $should_filter ) { if ( $should_filter ) {
add_filter('posts_where', [$this, '_filter_where'], 10, 2); add_filter('posts_where', [$this, '_filter_where'], 10, 2);
@ -407,6 +407,7 @@ class Items extends Repository {
global $wpdb; global $wpdb;
$clauses = []; $clauses = [];
$user_id = get_current_user_id(); $user_id = get_current_user_id();
$post_status = $wp_query->get( 'post_status' );
foreach ($this->fetching_from_collections as $collection) { foreach ($this->fetching_from_collections as $collection) {
@ -415,24 +416,32 @@ class Items extends Repository {
$clause = '('; $clause = '(';
$clause .= "{$wpdb->posts}.post_type = '{$collection->get_db_identifier()}' AND ("; $clause .= "{$wpdb->posts}.post_type = '{$collection->get_db_identifier()}' AND (";
$status_clause = [];
// public status // public status
$public_states = get_post_stati( array( 'public' => true ) ); $public_states = get_post_stati( array( 'public' => true ) );
$status_clause = [];
foreach ( (array) $public_states as $state ) { foreach ( (array) $public_states as $state ) {
if( empty($post_status) || in_array($state, $post_status) )
$status_clause[] = "{$wpdb->posts}.post_status = '$state'"; $status_clause[] = "{$wpdb->posts}.post_status = '$state'";
} }
$clause .= implode(' OR ', $status_clause);
// private statuses // private statuses
$private_states = get_post_stati( array( 'private' => true ) ); $private_states = get_post_stati( array( 'private' => true ) );
foreach ( (array) $private_states as $state ) { foreach ( (array) $private_states as $state ) {
$clause .= current_user_can( $read_private_cap ) ? " OR {$wpdb->posts}.post_status = '$state'" : " OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'"; if( empty($post_status) || in_array($state, $post_status) )
$status_clause[] = current_user_can( $read_private_cap ) ? " {$wpdb->posts}.post_status = '$state'" : " {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'";
} }
//draft
// $draft_states = get_post_stati( array( 'draft' => true ) );
$draft_states = ['draft'];
foreach ( $draft_states as $state ) {
if( !empty($post_status) && in_array($state, $post_status) )
$status_clause[] = current_user_can( $read_private_cap ) ? " {$wpdb->posts}.post_status = '$state'" : " {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'";
}
$clause .= implode(' OR ', $status_clause);
$clause .= ')'; $clause .= ')';
$clause .= ')'; $clause .= ')';
$clauses[] = $clause; $clauses[] = $clause;

View File

@ -2,9 +2,9 @@
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi
Tags: museums, libraries, archives, GLAM, collections, repository Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 5.8 Tested up to: 5.9
Requires PHP: 5.6 Requires PHP: 5.6
Stable tag: 0.18.7 Stable tag: 0.18.8
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,17 +4,17 @@ Plugin Name: Tainacan
Plugin URI: https://tainacan.org/ Plugin URI: https://tainacan.org/
Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform. Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform.
Author: Tainacan.org Author: Tainacan.org
Version: 0.18.7 Version: 0.18.8
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 5.8 Tested up to: 5.9
Requires PHP: 5.6 Requires PHP: 5.6
Stable tag: 0.18.7 Stable tag: 0.18.8
Text Domain: tainacan Text Domain: tainacan
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/ */
const TAINACAN_VERSION = '0.18.7'; const TAINACAN_VERSION = '0.18.8';
defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
$TAINACAN_BASE_URL = plugins_url('', __FILE__); $TAINACAN_BASE_URL = plugins_url('', __FILE__);

View File

@ -2046,6 +2046,7 @@ export default {
.document-field { .document-field {
/deep/ iframe { /deep/ iframe {
max-width: 100%; max-width: 100%;
max-height: 100%;
} }
.document-buttons-row { .document-buttons-row {
text-align: right; text-align: right;

View File

@ -44,7 +44,7 @@
<b-button <b-button
class="button is-secondary" class="button is-secondary"
tag="router-link" tag="router-link"
:to="$routerHelper.getCollectionItemsPath(collectionId, { metaquery: [{ key: relatedItemGroup.metadata_id, value: itemId, compare: 'IN' }] })"> :to="$routerHelper.getCollectionItemsPath(relatedItemGroup.collection_id, { metaquery: [{ key: relatedItemGroup.metadata_id, value: [itemId], compare: 'IN' }] })">
{{ $i18n.getWithVariables('label_view_all_%s_related_items', [relatedItemGroup.total_items]) }} {{ $i18n.getWithVariables('label_view_all_%s_related_items', [relatedItemGroup.total_items]) }}
</b-button> </b-button>
</div> </div>

View File

@ -743,6 +743,7 @@
.document-field { .document-field {
/deep/ iframe { /deep/ iframe {
max-width: 100%; max-width: 100%;
max-height: 100%;
} }
.document-buttons-row { .document-buttons-row {
text-align: right; text-align: right;

View File

@ -157,6 +157,10 @@
text-decoration: none; text-decoration: none;
} }
.swiper-slide-duplicate img {
display: initial !important;
}
.swiper-slide.collection-list-item-grid { .swiper-slide.collection-list-item-grid {
a { a {

View File

@ -586,6 +586,9 @@
} }
} }
} }
.swiper-slide-duplicate img {
display: initial !important;
}
} }
.block-editor-block-list__block>.wp-block-tainacan-carousel-items-list { .block-editor-block-list__block>.wp-block-tainacan-carousel-items-list {
max-width: calc(100% - 72px); max-width: calc(100% - 72px);

View File

@ -157,6 +157,10 @@
text-decoration: none; text-decoration: none;
} }
.swiper-slide-duplicate img {
display: initial !important;
}
.swiper-slide.term-list-item-grid { .swiper-slide.term-list-item-grid {
a { a {

View File

@ -35,11 +35,13 @@ export default function({ attributes, setAttributes, className, isSelected }) {
icon="no-alt" icon="no-alt"
label={__('Remove', 'tainacan')}/> label={__('Remove', 'tainacan')}/>
: :
<Button <button
onClick={ () => removeCollectionOfId(collection.id) } onClick={ () => removeCollectionOfId(collection.id) }
icon="no-alt" type="button"
showTooltip={false} class="components-button has-icon"
label={__('Remove', 'tainacan')} /> aria-label={__('Remove', 'tainacan')}>
<span class="dashicon dashicons dashicons-no-alt" />
</button>
} }
<a <a
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id } id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }

View File

@ -375,6 +375,7 @@ $pswp__include-minimal-style: true !default;
text-align: center; text-align: center;
padding: 44px; padding: 44px;
margin-top: 22px; margin-top: 22px;
margin-bottom: 22px;
&>iframe:not(.wp-embedded-content) { &>iframe:not(.wp-embedded-content) {
width: 90vw; width: 90vw;
@ -398,6 +399,11 @@ $pswp__include-minimal-style: true !default;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.pswp__zoom-wrap {
display: flex;
justify-content: center;
align-items: center;
}
.tainacan-content-embed { .tainacan-content-embed {
width: 100%; width: 100%;
@ -443,9 +449,12 @@ $pswp__include-minimal-style: true !default;
background: black; background: black;
min-height: 38px; min-height: 38px;
border-radius: 20px; border-radius: 20px;
min-width: 80%;
max-width: 80%;
} }
video { video {
min-height: 56px; min-height: 56px;
max-width: 80%;
} }
} }
.pswp__top-bar .pswp__name { .pswp__top-bar .pswp__name {

View File

@ -33,11 +33,13 @@ export default function({ attributes, setAttributes, className, isSelected }){
icon="no-alt" icon="no-alt"
label={__('Remove', 'tainacan')}/> label={__('Remove', 'tainacan')}/>
: :
<Button <button
onClick={ () => removeTermOfId(term.id) } onClick={ () => removeTermOfId(term.id) }
icon="no-alt" type="button"
showTooltip={false} class="components-button has-icon"
label={__('Remove', 'tainacan')}/> aria-label={__('Remove', 'tainacan')}>
<span class="dashicon dashicons dashicons-no-alt" />
</button>
} }
<a <a
id={ isNaN(term.id) ? term.id : 'term-id-' + term.id } id={ isNaN(term.id) ? term.id : 'term-id-' + term.id }

View File

@ -29,8 +29,8 @@ function _manually_load_plugin() {
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
// Start up the WP testing environment. // Start up the WP testing environment.
require_once dirname( dirname( __FILE__ ) ) . '/src/vendor/autoload.php';
require $_tests_dir . '/includes/bootstrap.php'; require $_tests_dir . '/includes/bootstrap.php';
require_once(__DIR__ . '/factories/class-tainacan-entity-factory.php'); require_once(__DIR__ . '/factories/class-tainacan-entity-factory.php');
require_once( __DIR__ . '/factories/class-tainacan-metadatum-factory.php' ); require_once( __DIR__ . '/factories/class-tainacan-metadatum-factory.php' );
require_once(__DIR__ . '/factories/class-tainacan-filter-factory.php'); require_once(__DIR__ . '/factories/class-tainacan-filter-factory.php');