Merge branch 'develop' into feature/483

This commit is contained in:
vnmedeiros 2021-04-26 14:33:49 -03:00
commit 9961ce062b
104 changed files with 4086 additions and 1138 deletions

2
.gitignore vendored
View File

@ -36,3 +36,5 @@ src/assets/css/tainacan-reports.css.map
src/.DS_Store
src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css.map
tests/wordpress-test
tests/wordpress-tests-lib

View File

@ -20,17 +20,23 @@ Tainacan is a software solution for building, managing and publishing digital re
### Features
**Easy installation**. As a WordPress plugin, Tainacan can be easily installed on and integrated to an existing WordPress website.
#### Easy install
- As a WordPress plugin, Tainacan can be easily installed on and integrated to an existing WordPress website.
**Metadata and filters**. Use a metadata standard or choose whatever set of metadata you want to describe the items in your collections. You can choose which metadata will be used as a filter when browsing the collection.
#### Metadata and filters
- Use standard metadata or choose whatever set of metadata you want to describe the items in your collections. You can choose which metadata will be used as a filter when browsing the collection.
**Faceted search**. Browse your collection (and let the public browse it) using a faceted search interface with the filters you have chosen.
#### Faceted search
- Browse (and let the public browse it) your collection using a faceted search interface with filters you have chosen.
**Manage taxonomies**. Manage vocabularies that can be used accross all your collections.
#### Manage taxonomies
- Manage vocabularies that can be used accross all your collections.
**Themes**. Tainacan [has its own default theme](https://wordpress.org/themes/tainacan-interface/), which helps you present your collections in a beautiful and effective way as it is developed to incorporate all of Tainacan functionalities. However, it will also work with any WordPress theme. For developers, it will be easy to add Tainacan specific features to an existing theme.
#### Themes
- Tainacan [has its own default theme](https://wordpress.org/themes/tainacan-interface/), which helps you present your collections in a beautiful and effective way as it is developed to incorporate all of Tainacan functionalities. However, it will also work with any WordPress theme. For developers, it will be easy to add Tainacan specific features to an existing theme.
**API and interoperability**. Tainacan implements a RESTful API (read and write) to allow other applications to interact with your repository. Expose you collection in different formats, such as JSON, JSON-LD and OAI-PMH. If your collection uses a custom standard, you can map it to well-known stardards such as DublinCore.
#### API and interoperability
- Tainacan implements a RESTful API (read and write) to allow other applications to interact with your repository. Expose you collection in different formats, such as JSON, JSON-LD and OAI-PMH. If your collection uses a custom standard, you can map it to well-known stardards such as DublinCore.
### Showcases

View File

@ -3,5 +3,3 @@
return [
'tests_dir' => '/tmp/wordpress-tests-lib',
];
?>

View File

@ -1,12 +1,11 @@
#!/bin/bash
## Run the build script whenever there is a change in src folder
## Runs build script whenever there is a change in src folder
echo 'Watching changes on src/'
current_OS=`uname`
# For macOS (Darwin) is needed fsevents-tools installed (you can use homebrew install fsevents-tools)
# For macOS (Darwin), you can install fsevents-tools via Homebrew: `brew install fsevents-tools`
if [ $current_OS == "Darwin" ]; then
echo
notifyloop src ./build.sh

View File

@ -1,5 +1,6 @@
#!/bin/bash
# Loads user-defined variables at build-config file
source build-config.cfg
## Only run npm build if there was a change in a .js or .vue file

View File

@ -2,44 +2,46 @@
# Executa o comando 'sass' para verificar se existe (veja http://stackoverflow.com/a/677212/329911)
command -v sass >/dev/null 2>&1 || {
echo >&2 "SASS parece não está disponivel.";
echo >&2 "Sass parece não estar disponivel.";
exit 1;
}
# Define o caminho.
echo "Compilando Sass..."
sass -E 'UTF-8' --cache-location .tmp/sass-cache-1 src/views/admin/scss/tainacan-admin.scss:src/assets/css/tainacan-admin.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-2 src/views/roles/tainacan-roles.scss:src/assets/css/tainacan-roles.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-3 src/views/reports/tainacan-reports.scss:src/assets/css/tainacan-reports.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/views/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/views/media-component/media-component.scss:src/assets/css/media-component.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/views/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/views/gutenberg-blocks/tainacan-items/items-list/items-list.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/views/gutenberg-blocks/tainacan-items/items-list/items-list.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/views/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-9 src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-9 src/views/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-11 src/views/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/views/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-13 src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-13 src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-14 src/views/gutenberg-blocks/tainacan-facets/faceted-search/faceted-search.scss:src/assets/css/tainacan-gutenberg-block-faceted-search.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-14 src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-15 src/views/gutenberg-blocks/tainacan-items/item-submission-form/item-submission-form.scss:src/assets/css/tainacan-gutenberg-block-item-submission-form.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-15 src/views/gutenberg-blocks/tainacan-facets/faceted-search/faceted-search.scss:src/assets/css/tainacan-gutenberg-block-faceted-search.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-16 src/views/gutenberg-blocks/gutenberg-blocks-style.scss:src/assets/css/tainacan-gutenberg-block-common-styles.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-16 src/views/gutenberg-blocks/tainacan-items/item-submission-form/item-submission-form.scss:src/assets/css/tainacan-gutenberg-block-item-submission-form.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-17 src/views/gutenberg-blocks/gutenberg-blocks-style.scss:src/assets/css/tainacan-gutenberg-block-common-styles.css
echo "Compilação do Sass Concluído!"
exit 0

57
package-lock.json generated
View File

@ -2385,11 +2385,11 @@
}
},
"buefy": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/buefy/-/buefy-0.9.4.tgz",
"integrity": "sha512-LRSIYVNrKTPQhmNRegASkntX+ObtZ7aSSA/3cybDKXzGtPNy8g8cl2tp79Rl8/LBVH/KkRT5rmmzJ21nxz9IcQ==",
"version": "0.9.7",
"resolved": "https://registry.npmjs.org/buefy/-/buefy-0.9.7.tgz",
"integrity": "sha512-Fli0ZjNDgtFtHm0LItWmfhNJ1oLjDwPzUWccvwXXoo2mADXaH8JQxyhY+drUuUV5/GMu5PtwqQSqPgZy942VZg==",
"requires": {
"bulma": "0.9.1"
"bulma": "0.9.2"
}
},
"buffer": {
@ -2428,9 +2428,9 @@
"dev": true
},
"bulma": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.1.tgz",
"integrity": "sha512-LSF69OumXg2HSKl2+rN0/OEXJy7WFEb681wtBlNS/ulJYR27J3rORHibdXZ6GVb/vyUzzYK/Arjyh56wjbFedA=="
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.2.tgz",
"integrity": "sha512-e14EF+3VSZ488yL/lJH0tR8mFWiEQVCMi/BQUMi2TGMBOk+zrDg4wryuwm/+dRSHJw0gMawp2tsW7X1JYUCE3A=="
},
"bytes": {
"version": "3.0.0",
@ -3531,18 +3531,32 @@
"dev": true
},
"elliptic": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"bn.js": "^4.11.9",
"brorand": "^1.1.0",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
"hmac-drbg": "^1.0.1",
"inherits": "^2.0.4",
"minimalistic-assert": "^1.0.1",
"minimalistic-crypto-utils": "^1.0.1"
},
"dependencies": {
"bn.js": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",
"dev": true
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
}
}
},
"emoji-regex": {
@ -7557,6 +7571,11 @@
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"photoswipe": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/photoswipe/-/photoswipe-4.1.3.tgz",
"integrity": "sha512-89Z43IRUyw7ycTolo+AaiDn3W1EEIfox54hERmm9bI12IB9cvRfHSHez3XhAyU8XW2EAFrC+2sKMhh7SJwn0bA=="
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
@ -12017,9 +12036,9 @@
"dev": true
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
},
"yallist": {
"version": "2.1.2",

View File

@ -9,15 +9,16 @@
},
"dependencies": {
"apexcharts": "^3.24.0",
"countup.js": "^2.0.7",
"axios": "^0.21.1",
"blurhash": "^1.1.3",
"buefy": "^0.9.4",
"bulma": "^0.9.1",
"countup.js": "^2.0.7",
"buefy": "^0.9.7",
"bulma": "^0.9.2",
"css-vars-ponyfill": "^2.3.1",
"mdi": "^2.2.43",
"moment": "^2.25.3",
"node-sass": "^4.14.1",
"photoswipe": "^4.1.3",
"qs": "^6.9.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",

View File

@ -1,4 +1,4 @@
#!/bin/bash
echo "Running unit tests in PHPUnit..."
echo "Running all unit tests [PHPUnit] ..."
phpunit

View File

@ -0,0 +1,896 @@
/*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */
/*
Styles for basic PhotoSwipe functionality (sliding area, open/close transitions)
*/
/* pswp = photoswipe */
.pswp {
display: none;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
overflow: hidden;
-ms-touch-action: none;
touch-action: none;
z-index: 9999999;
-webkit-text-size-adjust: 100%;
/* create separate layer, to avoid paint on window.onscroll in webkit/blink */
-webkit-backface-visibility: hidden;
outline: none; }
.pswp * {
box-sizing: border-box; }
.pswp img {
max-width: none; }
/* style is added when JS option showHideOpacity is set to true */
.pswp--animate_opacity {
/* 0.001, because opacity:0 doesn't trigger Paint action, which causes lag at start of transition */
opacity: 0.001;
will-change: opacity;
/* for open/close transition */
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); }
.pswp--open {
display: block; }
.pswp--zoom-allowed .pswp__img {
/* autoprefixer: off */
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in; }
.pswp--zoomed-in .pswp__img {
/* autoprefixer: off */
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab; }
.pswp--dragging .pswp__img {
/* autoprefixer: off */
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing; }
/*
Background is added as a separate element.
As animating opacity is much faster than animating rgba() background-color.
*/
.pswp__bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
opacity: 0;
transform: translateZ(0);
-webkit-backface-visibility: hidden;
will-change: opacity; }
.pswp__scroll-wrap {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden; }
.pswp__container,
.pswp__zoom-wrap {
-ms-touch-action: none;
touch-action: none;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0; }
/* Prevent selection and tap highlights */
.pswp__container,
.pswp__img {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-touch-callout: none; }
.pswp__zoom-wrap {
position: absolute;
width: 100%;
-webkit-transform-origin: left top;
-moz-transform-origin: left top;
-ms-transform-origin: left top;
transform-origin: left top;
/* for open/close transition */
transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1); }
.pswp__bg {
will-change: opacity;
/* for open/close transition */
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); }
.pswp--animated-in .pswp__bg,
.pswp--animated-in .pswp__zoom-wrap {
-webkit-transition: none;
transition: none; }
.pswp__container,
.pswp__zoom-wrap {
-webkit-backface-visibility: hidden; }
.pswp__item {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: hidden; }
.pswp__img {
position: absolute;
width: auto;
height: auto;
top: 0;
left: 0; }
/*
stretched thumbnail or div placeholder element (see below)
style is added to avoid flickering in webkit/blink when layers overlap
*/
.pswp__img--placeholder {
-webkit-backface-visibility: hidden; }
/*
div element that matches size of large image
large image loads on top of it
*/
.pswp__img--placeholder--blank {
background: #222; }
.pswp--ie .pswp__img {
width: 100% !important;
height: auto !important;
left: 0;
top: 0; }
/*
Error message appears when image is not loaded
(JS option errorMsg controls markup)
*/
.pswp__error-msg {
position: absolute;
left: 0;
top: 50%;
width: 100%;
text-align: center;
font-size: 14px;
line-height: 16px;
margin-top: -8px;
color: #CCC; }
.pswp__error-msg a {
color: #CCC;
text-decoration: underline; }
/*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */
/*
Contents:
1. Buttons
2. Share modal and links
3. Index indicator ("1 of X" counter)
4. Caption
5. Loading indicator
6. Additional styles (root element, top bar, idle state, hidden state, etc.)
*/
/*
1. Buttons
*/
/* <button> css reset */
.pswp__button {
width: 44px;
height: 44px;
position: relative;
background: none;
cursor: pointer;
overflow: visible;
-webkit-appearance: none;
display: block;
border: 0;
padding: 0;
margin: 0;
float: right;
opacity: 0.75;
transition: opacity 0.2s;
box-shadow: none; }
.pswp__button:focus, .pswp__button:hover {
opacity: 1; }
.pswp__button:active {
outline: none;
opacity: 0.9; }
.pswp__button::-moz-focus-inner {
padding: 0;
border: 0; }
/* pswp__ui--over-close class it added when mouse is over element that should close gallery */
.pswp__ui--over-close .pswp__button--close {
opacity: 1; }
.pswp__button,
.pswp__button--arrow--left:before,
.pswp__button--arrow--right:before {
background: url(../images/default-skin.png) 0 0 no-repeat;
background-size: 264px 88px;
width: 44px;
height: 44px; }
@media (-webkit-min-device-pixel-ratio: 1.1), (min-resolution: 105dpi), (min-resolution: 1.1dppx) {
/* Serve SVG sprite if browser supports SVG and resolution is more than 105dpi */
.pswp--svg .pswp__button,
.pswp--svg .pswp__button--arrow--left:before,
.pswp--svg .pswp__button--arrow--right:before {
background-image: url(../images/default-skin.svg); }
.pswp--svg .pswp__button--arrow--left,
.pswp--svg .pswp__button--arrow--right {
background: none; } }
.pswp__button--close {
background-position: 0 -44px; }
.pswp__button--share {
background-position: -44px -44px; }
.pswp__button--fs {
display: none; }
.pswp--supports-fs .pswp__button--fs {
display: block; }
.pswp--fs .pswp__button--fs {
background-position: -44px 0; }
.pswp__button--zoom {
display: none;
background-position: -88px 0; }
.pswp--zoom-allowed .pswp__button--zoom {
display: block; }
.pswp--zoomed-in .pswp__button--zoom {
background-position: -132px 0; }
/* no arrows on touch screens */
.pswp--touch .pswp__button--arrow--left,
.pswp--touch .pswp__button--arrow--right {
visibility: hidden; }
/*
Arrow buttons hit area
(icon is added to :before pseudo-element)
*/
.pswp__button--arrow--left,
.pswp__button--arrow--right {
background: none;
top: 50%;
margin-top: -50px;
width: 70px;
height: 100px;
position: absolute; }
.pswp__button--arrow--left {
left: 0; }
.pswp__button--arrow--right {
right: 0; }
.pswp__button--arrow--left:before,
.pswp__button--arrow--right:before {
content: '';
top: 35px;
background-color: rgba(0, 0, 0, 0.3);
height: 30px;
width: 32px;
position: absolute; }
.pswp__button--arrow--left:before {
left: 6px;
background-position: -138px -44px; }
.pswp__button--arrow--right:before {
right: 6px;
background-position: -94px -44px; }
/*
2. Share modal/popup and links
*/
.pswp__counter,
.pswp__share-modal {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none; }
.pswp__share-modal {
display: block;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
top: 0;
left: 0;
padding: 10px;
position: absolute;
z-index: 10000099;
opacity: 0;
transition: opacity 0.25s ease-out;
-webkit-backface-visibility: hidden;
will-change: opacity; }
.pswp__share-modal--hidden {
display: none; }
.pswp__share-tooltip {
z-index: 10000119;
position: absolute;
background: #FFF;
top: 56px;
border-radius: 2px;
display: block;
width: auto;
right: 44px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
transform: translateY(6px);
transition: transform 0.25s;
-webkit-backface-visibility: hidden;
will-change: transform; }
.pswp__share-tooltip a {
display: block;
padding: 8px 12px;
color: #000;
text-decoration: none;
font-size: 14px;
line-height: 18px; }
.pswp__share-tooltip a:hover {
text-decoration: none;
color: #000; }
.pswp__share-tooltip a:first-child {
/* round corners on the first/last list item */
border-radius: 2px 2px 0 0; }
.pswp__share-tooltip a:last-child {
border-radius: 0 0 2px 2px; }
.pswp__share-modal--fade-in {
opacity: 1; }
.pswp__share-modal--fade-in .pswp__share-tooltip {
transform: translateY(0); }
/* increase size of share links on touch devices */
.pswp--touch .pswp__share-tooltip a {
padding: 16px 12px; }
a.pswp__share--facebook:before {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
top: -12px;
right: 15px;
border: 6px solid rgba(0, 0, 0, 0);
border-bottom-color: #FFF;
-webkit-pointer-events: none;
-moz-pointer-events: none;
pointer-events: none; }
a.pswp__share--facebook:hover {
background: #3E5C9A;
color: #FFF; }
a.pswp__share--facebook:hover:before {
border-bottom-color: #3E5C9A; }
a.pswp__share--twitter:hover {
background: #55ACEE;
color: #FFF; }
a.pswp__share--pinterest:hover {
background: #CCC;
color: #CE272D; }
a.pswp__share--download:hover {
background: #DDD; }
/*
3. Index indicator ("1 of X" counter)
*/
.pswp__counter {
position: absolute;
left: 0;
top: 0;
height: 44px;
font-size: 13px;
line-height: 44px;
color: #FFF;
opacity: 0.75;
padding: 0 10px; }
/*
4. Caption
*/
.pswp__caption {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
min-height: 44px; }
.pswp__caption small {
font-size: 11px;
color: #BBB; }
.pswp__caption__center {
text-align: left;
max-width: 420px;
margin: 0 auto;
font-size: 13px;
padding: 10px;
line-height: 20px;
color: #CCC; }
.pswp__caption--empty {
display: none; }
/* Fake caption element, used to calculate height of next/prev image */
.pswp__caption--fake {
visibility: hidden; }
/*
5. Loading indicator (preloader)
You can play with it here - http://codepen.io/dimsemenov/pen/yyBWoR
*/
.pswp__preloader {
width: 44px;
height: 44px;
position: absolute;
top: 0;
left: 50%;
margin-left: -22px;
opacity: 0;
transition: opacity 0.25s ease-out;
will-change: opacity;
direction: ltr; }
.pswp__preloader__icn {
width: 20px;
height: 20px;
margin: 12px; }
.pswp__preloader--active {
opacity: 1; }
.pswp__preloader--active .pswp__preloader__icn {
/* We use .gif in browsers that don't support CSS animation */
background: url(../images/preloader.gif) 0 0 no-repeat; }
.pswp--css_animation .pswp__preloader--active {
opacity: 1; }
.pswp--css_animation .pswp__preloader--active .pswp__preloader__icn {
animation: clockwise 500ms linear infinite; }
.pswp--css_animation .pswp__preloader--active .pswp__preloader__donut {
animation: donut-rotate 1000ms cubic-bezier(0.4, 0, 0.22, 1) infinite; }
.pswp--css_animation .pswp__preloader__icn {
background: none;
opacity: 0.75;
width: 14px;
height: 14px;
position: absolute;
left: 15px;
top: 15px;
margin: 0; }
.pswp--css_animation .pswp__preloader__cut {
/*
The idea of animating inner circle is based on Polymer ("material") loading indicator
by Keanu Lee https://blog.keanulee.com/2014/10/20/the-tale-of-three-spinners.html
*/
position: relative;
width: 7px;
height: 14px;
overflow: hidden; }
.pswp--css_animation .pswp__preloader__donut {
box-sizing: border-box;
width: 14px;
height: 14px;
border: 2px solid #FFF;
border-radius: 50%;
border-left-color: transparent;
border-bottom-color: transparent;
position: absolute;
top: 0;
left: 0;
background: none;
margin: 0; }
@media screen and (max-width: 1024px) {
.pswp__preloader {
position: relative;
left: auto;
top: auto;
margin: 0;
float: right; } }
@keyframes clockwise {
0% {
transform: rotate(0deg); }
100% {
transform: rotate(360deg); } }
@keyframes donut-rotate {
0% {
transform: rotate(0); }
50% {
transform: rotate(-140deg); }
100% {
transform: rotate(0); } }
/*
6. Additional styles
*/
/* root element of UI */
.pswp__ui {
-webkit-font-smoothing: auto;
visibility: visible;
opacity: 1;
z-index: 10000049; }
/* top black bar with buttons and "1 of X" indicator */
.pswp__top-bar {
position: absolute;
left: 0;
top: 0;
height: 44px;
width: 100%; }
.pswp__caption,
.pswp__top-bar,
.pswp--has_mouse .pswp__button--arrow--left,
.pswp--has_mouse .pswp__button--arrow--right {
-webkit-backface-visibility: hidden;
will-change: opacity;
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); }
/* pswp--has_mouse class is added only when two subsequent mousemove events occur */
.pswp--has_mouse .pswp__button--arrow--left,
.pswp--has_mouse .pswp__button--arrow--right {
visibility: visible; }
.pswp__top-bar,
.pswp__caption {
background-color: rgba(0, 0, 0, 0.5); }
/* pswp__ui--fit class is added when main image "fits" between top bar and bottom bar (caption) */
.pswp__ui--fit .pswp__top-bar,
.pswp__ui--fit .pswp__caption {
background-color: rgba(0, 0, 0, 0.3); }
/* pswp__ui--idle class is added when mouse isn't moving for several seconds (JS option timeToIdle) */
.pswp__ui--idle .pswp__top-bar {
opacity: 0; }
.pswp__ui--idle .pswp__button--arrow--left,
.pswp__ui--idle .pswp__button--arrow--right {
opacity: 0; }
/*
pswp__ui--hidden class is added when controls are hidden
e.g. when user taps to toggle visibility of controls
*/
.pswp__ui--hidden .pswp__top-bar,
.pswp__ui--hidden .pswp__caption,
.pswp__ui--hidden .pswp__button--arrow--left,
.pswp__ui--hidden .pswp__button--arrow--right {
/* Force paint & create composition layer for controls. */
opacity: 0.001; }
/* pswp__ui--one-slide class is added when there is just one item in gallery */
.pswp__ui--one-slide .pswp__button--arrow--left,
.pswp__ui--one-slide .pswp__button--arrow--right,
.pswp__ui--one-slide .pswp__counter {
display: none; }
.pswp__element--disabled {
display: none !important; }
.pswp--minimal--dark .pswp__top-bar {
background: none; }
.tainacan-media-component {
--swiper-theme-color: var(--tainacan-secondary, #298596);
--swiper-navigation-size: 44px;
--tainacan-media-background: var(--tainacan-background-color, #ffffff);
--tainacan-media-main-carousel-height: 60vh;
--tainacan-media-main-carousel-width: 100%;
--tainacan-media-thumbs-carousel-width: 100%;
--tainacan-media-thumbs-carousel-item-size: 136px;
width: 100%;
height: auto;
display: block;
background-color: var(--tainacan-media-background, #ffffff); }
/* Style valid for both cases of carousel, main and thumbs */
.tainacan-media-component__swiper-main .swiper-button-prev::after,
.tainacan-media-component__swiper-main .swiper-container-rtl .swiper-button-next::after,
.tainacan-media-component__swiper-thumbs .swiper-button-prev::after,
.tainacan-media-component__swiper-thumbs .swiper-container-rtl .swiper-button-next::after {
content: 'previous'; }
.tainacan-media-component__swiper-main .swiper-button-next::after,
.tainacan-media-component__swiper-main .swiper-button-prev::after,
.tainacan-media-component__swiper-thumbs .swiper-button-next::after,
.tainacan-media-component__swiper-thumbs .swiper-button-prev::after {
font-family: "TainacanIcons";
opacity: 0.7;
transition: opacity ease 0.2s; }
.tainacan-media-component__swiper-main:hover .swiper-button-next::after,
.tainacan-media-component__swiper-main:hover .swiper-button-prev::after,
.tainacan-media-component__swiper-thumbs:hover .swiper-button-next::after,
.tainacan-media-component__swiper-thumbs:hover .swiper-button-prev::after {
opacity: 1; }
.tainacan-media-component__swiper-main ul.swiper-wrapper,
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
list-style: none;
padding: 0; }
.tainacan-media-component__swiper-main {
width: 100%;
max-width: var(--tainacan-media-main-carousel-width, 100%); }
.tainacan-media-component__swiper-main ul.swiper-wrapper {
display: flex;
align-items: center;
margin-bottom: 30px; }
.tainacan-media-component__swiper-main ul.swiper-wrapper[data-pswp-uid] li.swiper-slide img {
cursor: zoom-in !important; }
.tainacan-media-component__swiper-main li.swiper-slide {
height: 100%;
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
min-width: 100%;
padding: 0 var(--swiper-navigation-size, 44px);
opacity: 1.0;
transition: opacity 0.2s linear; }
.tainacan-media-component__swiper-main li.swiper-slide:not(.swiper-slide-active) {
opacity: 0.75; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata {
text-align: center; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata.hide-name .swiper-slide-metadata__name {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata.hide-description .swiper-slide-metadata__description {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata.hide-caption .swiper-slide-metadata__caption {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata__name {
font-size: 1em;
font-weight: bold;
color: var(--tainacan-label-color, #454647); }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata__caption {
font-size: 0.9375em;
color: var(--tainacan-input-color, #1d1d1d); }
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata__caption {
font-size: 0.875em;
color: var(--tainacan-info-color, #555758); }
.tainacan-media-component__swiper-main .swiper-slide-content {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column; }
.tainacan-media-component__swiper-main .swiper-slide-content .tainacan-embed-container {
width: 100%;
height: auto; }
.tainacan-media-component__swiper-main .swiper-slide-content iframe {
max-height: var(--tainacan-media-main-carousel-height, 60vh);
width: 100%;
max-width: 100%;
border: none;
display: block;
background-image: url("../images/preloader.gif");
background-repeat: no-repeat;
background-position: center; }
.tainacan-media-component__swiper-main .swiper-slide-content a:first-of-type,
.tainacan-media-component__swiper-main .swiper-slide-content p:first-of-type {
z-index: 99;
background: var(--tainacan-media-background, #ffffff);
border-radius: 3px;
word-wrap: break-word; }
.tainacan-media-component__swiper-main .swiper-slide-content audio {
background: black;
min-height: 38px;
border-radius: 20px;
width: 100%;
height: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh); }
.tainacan-media-component__swiper-main .swiper-slide-content video {
min-height: 56px;
width: 100%;
height: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh); }
.tainacan-media-component__swiper-main .swiper-slide-content img {
width: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh); }
.tainacan-media-component__swiper-thumbs {
width: 100%;
max-width: var(--tainacan-media-thumbs-carousel-width, 100%); }
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
margin: 0 var(--swiper-navigation-size, 44px);
margin-bottom: 30px; }
.tainacan-media-component__swiper-thumbs li.swiper-slide {
text-align: center;
vertical-align: top;
word-break: break-all;
font-size: 0.875em;
max-width: calc(var(--tainacan-media-thumbs-carousel-item-size, 136px) + 17px);
cursor: zoom-in; }
@media only screen and (max-width: 380px) {
.tainacan-media-component__swiper-thumbs li.swiper-slide {
margin: 10px 0; } }
.tainacan-media-component__swiper-thumbs li.swiper-slide img {
width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
height: var(--tainacan-media-thumbs-carousel-item-size, 136px);
max-width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
max-height: var(--tainacan-media-thumbs-carousel-item-size, 136px);
object-fit: cover;
object-position: center;
border-bottom-width: 6px;
border-bottom-style: solid;
background-color: var(--tainacan-media-background, #ffffff);
border-bottom-color: rgba(255, 255, 255, 0);
opacity: 0.85;
transition: opacity 0.3s ease, border-bottom-color 0.3s ease; }
.tainacan-media-component__swiper-thumbs li.swiper-slide img:focus, .tainacan-media-component__swiper-thumbs li.swiper-slide img:hover {
opacity: 0.95;
outline: none;
border-bottom-color: var(--swiper-theme-color, #298596); }
.tainacan-media-component__swiper-thumbs li.swiper-slide.swiper-slide-thumb-active .swiper-slide-metadata__name {
font-weight: bold; }
.tainacan-media-component__swiper-thumbs li.swiper-slide.swiper-slide-thumb-active img {
opacity: 1.0;
border-bottom-color: var(--swiper-theme-color, #298596); }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata__name {
font-size: 1em;
color: var(--tainacan-label-color, #454647); }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata__caption {
font-size: 0.9375em;
color: var(--tainacan-input-color, #1d1d1d); }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata__caption {
font-size: 0.875em;
color: var(--tainacan-info-color, #555758); }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata {
text-align: center;
display: block;
margin-top: 0.5rem; }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata.hide-name .swiper-slide-metadata__name {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata.hide-description .swiper-slide-metadata__description {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-thumbs li.swiper-slide .swiper-slide-metadata.hide-caption .swiper-slide-metadata__caption {
display: none;
visibility: hidden; }
.tainacan-media-component__swiper-thumbs li.swiper-slide a {
width: 100%;
max-width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
text-align: center;
word-break: break-word; }
.tainacan-media-component__swiper-thumbs li.swiper-slide a,
.tainacan-media-component__swiper-thumbs li.swiper-slide a:focus,
.tainacan-media-component__swiper-thumbs li.swiper-slide a:hover {
outline: none;
text-decoration: none;
color: var(--tainacan-gray5, #454647); }
.tainacan-media-component__swiper-thumbs .swiper-start-border {
position: absolute;
height: 100%;
width: calc(32px + var(--swiper-navigation-size, 44px));
background-image: linear-gradient(90deg, var(--tainacan-media-background, #ffffff) 25%, transparent);
top: 0;
left: 0;
z-index: 1; }
.tainacan-media-component__swiper-thumbs .swiper-end-border {
position: absolute;
height: 100%;
width: calc(32px + var(--swiper-navigation-size, 44px));
background-image: linear-gradient(90deg, transparent, var(--tainacan-media-background, #ffffff) 75%);
top: 0;
right: 0;
z-index: 1; }
.tainacan-media-component__swiper-main + .tainacan-media-component__swiper-thumbs li.swiper-slide {
cursor: pointer; }
.tainacan-photoswipe-layer .pswp__bg {
background-color: rgba(0, 0, 0, 0.85); }
.tainacan-photoswipe-layer .pswp__ui--fit .pswp__top-bar,
.tainacan-photoswipe-layer .pswp__ui--fit .pswp__caption {
background-color: rgba(0, 0, 0, 0.7); }
.tainacan-photoswipe-layer .pswp__button--arrow--left::before,
.tainacan-photoswipe-layer .pswp__button--arrow--right::before {
background-color: rgba(0, 0, 0, 0.5); }
.tainacan-photoswipe-layer .pswp__container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center; }
.tainacan-photoswipe-layer .pswp__container .attachment-without-image {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center; }
.tainacan-photoswipe-layer .pswp__container .attachment-without-image.tainacan-embed-container:not(.tainacan-embed-without-iframe) {
padding: 0px; }
.tainacan-photoswipe-layer .pswp__container .attachment-without-image .tainacan-embed-container .twitter-tweet {
width: 100vw !important; }
.tainacan-photoswipe-layer .pswp__container iframe {
padding: 44px;
min-height: 90vh;
max-height: 90vh;
height: 100%;
width: 100%;
max-width: 100%;
margin: 0 auto;
border: none;
display: block;
background-image: url("../images/preloader.gif");
background-repeat: no-repeat;
background-position: center; }
.tainacan-photoswipe-layer .pswp__container a:first-of-type,
.tainacan-photoswipe-layer .pswp__container p:first-of-type,
.tainacan-photoswipe-layer .pswp__container article:first-of-type {
z-index: 99;
padding: 1rem 4.33337vw;
background: var(--tainacan-media-background, #ffffff);
border-radius: var(--borderRadius, 3px);
word-wrap: break-word; }
.tainacan-photoswipe-layer .pswp__container audio {
background: black;
min-height: 38px;
border-radius: 20px; }
.tainacan-photoswipe-layer .pswp__container video {
min-height: 56px; }
.tainacan-photoswipe-layer .pswp__top-bar .pswp__name {
color: white;
text-align: center;
font-size: 1.125em;
display: block;
height: 44px;
max-width: calc(100% - 240px);
width: 100%;
left: 44px;
position: absolute;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 44px;
padding: 0 10px; }
.tainacan-photoswipe-layer .pswp__figure_caption {
font-size: 0.875em;
font-style: italic; }
.tainacan-photoswipe-layer .pswp__description {
font-size: 0.9375em; }
.tainacan-photoswipe-layer .pswp__caption__center {
text-align: center;
font-size: 1em;
max-width: 800px; }
/*# sourceMappingURL=media-component.css.map */

File diff suppressed because one or more lines are too long

View File

@ -8,12 +8,36 @@
.tainacan-embed-container:not(.tainacan-embed-without-iframe) {
padding-bottom: 56.25%;
padding-top: 30px;
width: 100%;
margin: auto;
}
.tainacan-embed-container .twitter-tweet {
margin: 0 auto;
}
.tainacan-embed-container iframe.wp-embedded-content {
display: flex !important;
align-items: center;
justify-content: center;
margin: auto !important;
width: auto !important;
top: 50%;
bottom: 50%;
}
@media screen and (max-width: 1024px) {
.tainacan-embed-container iframe.wp-embedded-content {
position: relative;
}
}
.tainacan-embed-container #tainacan-attachment-iframe { /* PDF */
width: 100%;
}
.tainacan-embed-container iframe,
.tainacan-embed-container object,
.tainacan-embed-container embed {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;

View File

@ -269,6 +269,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item:hover button {
height: auto;
visibility: visible;

File diff suppressed because one or more lines are too long

View File

@ -242,6 +242,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item:hover button {
height: auto;
visibility: visible;

File diff suppressed because one or more lines are too long

View File

@ -270,6 +270,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover button {
height: auto;
visibility: visible;

File diff suppressed because one or more lines are too long

View File

@ -79,6 +79,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button {
height: auto;
visibility: visible;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,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E,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAlD9C;oHAAwB;UAmDhB,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
"sources": ["../../views/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-collections-list.css"

View File

@ -83,6 +83,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button {
height: auto;
visibility: visible;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;4EAC6C;IACzC,qBAAqB,EAAE,wBAAwB;IAC/C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,eAAe;IAEnC;iFAAG;MACC,UAAU,EAAE,YAAY;MACxB,YAAY,EAAE,YAAY;MAC1B,WAAW,EAAE,YAAY;MACzB,MAAM,EAAE,gBAAgB;MAExB;uFAAI;QACA,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,cAAc;EAIzC;oEACqC;IACjC,OAAO,EAAE,CAAC;ICtCd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IDqCT,gBAAgB,EAAE,6BAA6B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QA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AM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,UAAU;MAG1B;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,oCAAmC;QAC1C,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
"sources": ["../../views/gutenberg-blocks/tainacan-items/items-list/items-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-items-list.css"

View File

@ -64,6 +64,8 @@
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item button .dashicon {
margin: 0px; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button {
height: auto;
visibility: visible;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;o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EAAE,UAAU;MAG1B;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,oCAAmC;QAC1C,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
"sources": ["../../views/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-terms-list.css"

View File

@ -16,7 +16,6 @@ body:not([class]) > iframe {
min-height: 80vh;
border: none;
}
body:not([class]) > audio,
body:not([class]) > video {
width: 100%;
height: auto;
@ -25,6 +24,11 @@ body:not([class]) > video {
}
body:not([class]) > audio {
width: 100%;
height: auto;
border-radius: 20px;
background: black;
min-height: 38px;
max-height: 100%;
}
body:not([class]) > a,
body:not([class]) > p {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg39"
version="1.1"
viewBox="0 0 264 88"
height="88"
width="264">
<metadata
id="metadata45">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>default-skin 2</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs43" />
<title
id="title2">default-skin 2</title>
<path
id="Shape"
d="m 67.002,59.5 v 3.768 C 60.695,64.108 57.818,69.018 57,73 59.22,70.17 62.564,67.902 67.002,67.902 V 71.5 L 73,65.585 Z"
style="fill:#ffffff;fill-rule:evenodd" />
<g
style="fill:#ffffff;fill-rule:evenodd"
id="g7">
<path
id="path5"
d="m 13,29 v -5 h 2 v 3 h 3 v 2 z m 0,-14 h 5 v 2 h -3 v 3 h -2 z m 18,0 v 5 h -2 v -3 h -3 v -2 z m 0,14 h -5 v -2 h 3 v -3 h 2 z" />
</g>
<g
style="fill:#ffffff;fill-rule:evenodd"
id="g11">
<path
id="path9"
d="m 62,24 v 5 h -2 v -3 h -3 v -2 z m 0,-4 h -5 v -2 h 3 v -3 h 2 z m 8,0 v -5 h 2 v 3 h 3 v 2 z m 0,4 h 5 v 2 h -3 v 3 h -2 z" />
</g>
<path
id="path13"
d="M 20.586,66 14.93,60.344 16.344,58.93 22,64.586 27.656,58.93 29.07,60.344 23.414,66 29.07,71.656 27.656,73.07 22,67.414 16.344,73.07 14.93,71.656 Z"
style="fill:#ffffff;fill-rule:evenodd" />
<path
id="path15"
d="m 108.09738,65.891437 -2.03999,-1.748574 c 1.38784,-1.589364 1.3957,-1.596523 4.44849,-5.142894 -2.91228,-3.313711 -2.89516,-3.3306 -4.44849,-5.142833 L 108.09738,52.179419 114.05739,59 Z"
style="fill:#ffffff;fill-rule:evenodd;stroke-width:1.14285851" />
<path
id="path17"
d="m 155.5635,65.896657 2.04,-1.748571 c -1.49112,-1.796968 -1.49059,-1.799812 -4.33482,-5.142858 3.02761,-3.609572 3.02493,-3.60229 4.33482,-5.142857 l -2.04,-1.677714 -5.96,6.820571 z"
style="fill:#ffffff;fill-rule:evenodd;stroke-width:1.14285719" />
<g
id="g23"
style="fill:none;fill-rule:evenodd">
<path
style="fill:#ffffff"
d="m 160.957,28.543 -3.25,-3.25 -1.413,1.414 3.25,3.25 z"
id="Rectangle-11" />
<path
style="stroke:#ffffff;stroke-width:1.5"
id="Oval-1"
d="m 152.5,27 c 3.038,0 5.5,-2.462 5.5,-5.5 0,-3.038 -2.462,-5.5 -5.5,-5.5 -3.038,0 -5.5,2.462 -5.5,5.5 0,3.038 2.462,5.5 5.5,5.5 z" />
<path
style="fill:#ffffff"
id="path21"
d="m 150,21 h 5 v 1 h -5 z" />
</g>
<g
id="g33"
style="fill:none;fill-rule:evenodd">
<path
style="fill:#ffffff"
id="path25"
d="m 116.957,28.543 -1.414,1.414 -3.25,-3.25 1.414,-1.414 z" />
<path
style="stroke:#ffffff;stroke-width:1.5"
id="path27"
d="m 108.5,27 c 3.038,0 5.5,-2.462 5.5,-5.5 0,-3.038 -2.462,-5.5 -5.5,-5.5 -3.038,0 -5.5,2.462 -5.5,5.5 0,3.038 2.462,5.5 5.5,5.5 z" />
<path
style="fill:#ffffff"
id="path29"
d="m 106,21 h 5 v 1 h -5 z" />
<path
style="fill:#ffffff"
id="path31"
d="m 109.043,19.008 -0.085,5 -1,-0.017 0.085,-5 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

View File

@ -4,7 +4,6 @@ namespace Tainacan\API;
class REST_Controller extends \WP_REST_Controller {
/**
* REST_Controller constructor.
*/
@ -624,7 +623,6 @@ class REST_Controller extends \WP_REST_Controller {
}
function get_permissions_schema() {
return [
@ -655,5 +653,3 @@ class REST_Controller extends \WP_REST_Controller {
}
}
?>

View File

@ -231,7 +231,6 @@ class REST_Background_Processes_Controller extends REST_Controller {
$result = $this->prepare_item_for_response($result, $request);
return new \WP_REST_Response( $result, 200 );
}
public function prepare_item_for_response($item, $request) {
@ -309,8 +308,6 @@ class REST_Background_Processes_Controller extends REST_Controller {
$result = $this->prepare_item_for_response($result, $request);
return new \WP_REST_Response( $result, 200 );
}
public function delete_item( $request ) {
@ -334,7 +331,6 @@ class REST_Background_Processes_Controller extends REST_Controller {
// TODO: delete log files
return new \WP_REST_Response( $result, 200 );
}
public function get_log_url($id, $action, $type = '') {
@ -352,7 +348,6 @@ class REST_Background_Processes_Controller extends REST_Controller {
$logs_url = $upload_url . 'tainacan/' . $filename;
return $logs_url;
}
}

View File

@ -188,10 +188,9 @@ class REST_Item_Metadata_Controller extends REST_Controller {
$body = json_decode( $request->get_body(), true );
if ($body) {
$item_id = $request['item_id'];
$metadatum_id = $request['metadatum_id'];
$value = $body['values'];
$metadatum_id = $request['metadatum_id'];
$parent_meta_id = isset( $body['parent_meta_id'] ) && $body['parent_meta_id'] > 0 ? $body['parent_meta_id'] : null;
$item = $this->item_repository->fetch($item_id);
@ -199,13 +198,8 @@ class REST_Item_Metadata_Controller extends REST_Controller {
$item_metadata = new Entities\Item_Metadata_Entity( $item, $metadatum, null, $parent_meta_id);
if($item_metadata->is_multiple()) {
$value = $this->get_metadata_value($item_metadata->is_multiple(), $value);
$item_metadata->set_value($value);
} elseif(is_array($value)) {
$item_metadata->set_value(implode(' ', $value));
} else {
$item_metadata->set_value($value);
}
if ($item_metadata->validate()) {
if($item->can_edit()) {
@ -378,6 +372,12 @@ class REST_Item_Metadata_Controller extends REST_Controller {
}
}
private function get_metadata_value($is_multiple, $value) {
if ($is_multiple) {
return $value;
} elseif (is_array($value)) {
return implode(' ', $value);
}
return $value;
}
}
?>

View File

@ -708,7 +708,6 @@ class REST_Items_Controller extends REST_Controller {
*/
public function update_item( $request ) {
$item_id = $request['item_id'];
$body = json_decode($request->get_body(), true);
if (!empty($body)) {

View File

@ -9,7 +9,6 @@ use Tainacan\Repositories\Repository;
class REST_Logs_Controller extends REST_Controller {
private $logs_repository;
private $log;
/**
* REST_Logs_Controller constructor.
@ -364,5 +363,3 @@ class REST_Logs_Controller extends REST_Controller {
return $schema;
}
}
?>

View File

@ -191,6 +191,9 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
if ($status == 'finished') {
$params['progress_label'] = __('Process completed','tainacan');
$params['progress_value'] = 100;
} else if ($status == 'finished-errors') {
$params['progress_label'] = __('Process completed with errors','tainacan');
$params['progress_value'] = 100;
}
$wpdb->update(
$this->table,
@ -279,17 +282,15 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
*/
protected function handle() {
$this->lock_process();
// while we are debugging performance
$newRequest = true;
$batch = $this->get_batch();
if ($newRequest) {
$this->write_log($batch->key, ['New Request']);
$newRequest = false;
if($this->process_lock_in_time != get_site_transient( $this->identifier . '_process_lock' )) {
$this->write_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'New request has ignored']]);
wp_die();
}
$this->write_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'New Request']]);
register_shutdown_function(function() use($batch) {
$error = error_get_last();
@ -308,8 +309,8 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
$this->debug('Shutdown with Fatal error captured');
$this->debug($error_str);
$this->write_error_log($batch->key, ['Fatal Error: ' . $error_str]);
$this->write_error_log($batch->key, ['Process aborted']);
$this->write_error_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'Fatal Error: ' . $error_str]] );
$this->write_error_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'Process aborted']]);
$this->close( $batch->key, 'errored' );
$this->debug('Batch closed due to captured error');
$this->unlock_process();
@ -323,8 +324,8 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
$task = $this->task( $task );
} catch (\Exception $e) {
// TODO: Add Stacktrace
$this->write_error_log($batch->key, ['Fatal Error: ' . $e->getMessage()]);
$this->write_error_log($batch->key, ['Process aborted']);
$this->write_error_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'Fatal Error: ' . $e->getMessage()]]);
$this->write_error_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'Process aborted']]);
$task = false;
$close_status = 'errored';
}
@ -352,7 +353,7 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
} else {
$this->debug('Complete');
$this->complete();
$this->write_log($batch->key, ['Process Finished']);
$this->write_log($batch->key, [['datetime' => date("Y-m-d H:i:s"), 'message' => 'Process Finished']] );
}
$this->debug('dying');
@ -436,18 +437,21 @@ abstract class Background_Process extends \Tainacan_WP_Background_Process {
private function recursive_stingify_log_array(array $log, $break = true) {
$return = '';
foreach ($log as $k => $l) {
$l_datetime = $l['datetime'];
$l_message = $l['message'];
$return .= "[$l_datetime] ";
if (!is_numeric($k)) {
$return .= $k . ': ';
}
if (is_array($l)) {
//$return .= $this->recursive_stingify_log_array($l, false);
$return .= print_r($l, true);
} elseif (is_string($l)) {
$return .= $l;
if (is_array($l_message)) {
//$return .= $this->recursive_stingify_log_array($l_message, false);
$return .= print_r($l_message, true);
} elseif (is_string($l_message)) {
$return .= $l_message;
}
$return .="\n";
//$return .= $break ? "\n" : ', ';
}
return $return;

View File

@ -764,7 +764,11 @@ class Elastic_Press {
$metadatadum = \Tainacan\Repositories\Metadata::get_instance()->fetch($metada_id);
if ( isset($metadatadum->get_metadata_type_options()['collection_id'])) {
$item = \Tainacan\Repositories\Items::get_instance()->fetch(intval($term['key']));
if( $item instanceof Entities\Item) {
$label = $item->get_title();
} else {
continue;
}
}
}
$fct = [
@ -855,7 +859,11 @@ class Elastic_Press {
$metadatadum = \Tainacan\Repositories\Metadata::get_instance()->fetch($metada_id);
if ( isset($metadatadum->get_metadata_type_options()['collection_id'])) {
$item = \Tainacan\Repositories\Items::get_instance()->fetch($term['key'][$key]);
if( $item instanceof Entities\Item) {
$label = $item->get_title();
} else {
continue;
}
}
}

View File

@ -21,8 +21,6 @@ class Media {
protected function __construct() {
add_action( 'init', [$this, 'add_attachment_page_rewrite_rule'] );
add_action( 'admin_enqueue_scripts', array( &$this, 'add_css' ) );
add_action( 'wp_enqueue_scripts', array( &$this, 'add_css' ) );
add_filter( 'query_vars', [$this, 'attachment_page_add_var'] );
add_action( 'template_redirect', [$this, 'attachment_page'] );
@ -367,6 +365,7 @@ class Media {
$output .= $img;
} else {
$this->add_css();
wp_print_styles('tainacan-media-page');
global $wp_embed;

View File

@ -31,7 +31,6 @@ class Item_Metadata_Entity extends Entity {
* @param int $meta_id ID for a specific meta row
*/
function __construct(Item $item = null, Metadatum $metadatum = null, $meta_id = null, $parent_meta_id = null) {
$this->set_item($item);
$this->set_metadatum($metadatum);
@ -142,11 +141,9 @@ class Item_Metadata_Entity extends Entity {
if (is_object($metadatum)) {
$fto = $metadatum->get_metadata_type_object();
if (is_object($fto)) {
if ( method_exists($fto, 'get_value_as_html') ) {
return $fto->get_value_as_html($this);
}
}
}
@ -155,7 +152,6 @@ class Item_Metadata_Entity extends Entity {
$return = '';
if ( $this->is_multiple() ) {
$total = sizeof($value);
$count = 0;
$prefix = $this->get_multivalue_prefix();
@ -163,13 +159,9 @@ class Item_Metadata_Entity extends Entity {
$separator = $this->get_multivalue_separator();
foreach ($value as $v) {
$return .= $prefix;
$return .= (string) $v;
$return .= $suffix;
$count ++;
if ($count < $total)
$return .= $separator;
@ -180,8 +172,6 @@ class Item_Metadata_Entity extends Entity {
}
return $return;
}
/**
@ -199,10 +189,9 @@ class Item_Metadata_Entity extends Entity {
public function get_value_as_array() {
$value = $this->get_value();
$primitive_type = $this->get_metadatum()->get_metadata_type_object()->get_primitive_type();
if ( $this->is_multiple() ) {
$return = [];
if ($this->is_multiple()) {
foreach ($value as $v) {
if( is_array($v) ) {
$options = $this->get_metadatum()->get_metadata_type_object()->get_options();
@ -227,11 +216,7 @@ class Item_Metadata_Entity extends Entity {
$return[] = $v;
}
}
} else {
$return = '';
if ($primitive_type === 'compound') {
$compounds = [];
$compounds_not_ordinate = [];
@ -274,7 +259,6 @@ class Item_Metadata_Entity extends Entity {
}
return $return;
}
/**
@ -410,7 +394,7 @@ class Item_Metadata_Entity extends Entity {
/**
* Return the metadatum value
*
* @return string | integer
* @return string|integer|Array
*/
function get_value() {
if (isset($this->value))
@ -462,7 +446,7 @@ class Item_Metadata_Entity extends Entity {
}
/**
* Validate attributes
* Returns whether metadata value is valid
*
* @return boolean
*/
@ -476,25 +460,18 @@ class Item_Metadata_Entity extends Entity {
return false;
}
if (empty($value) && $this->is_required() && in_array( $item->get_status(), apply_filters( 'tainacan-status-require-validation', [
'publish',
'future',
'private'
] ) )
) {
if (empty($value) && $value !== '0' && $value !== 0) {
if ($this->is_required()) {
$validation_statuses = ['publish', 'future', 'private'];
if (in_array($item->get_status(), apply_filters( 'tainacan-status-require-validation', $validation_statuses) )) {
$this->add_error('required', $metadatum->get_name() . ' is required');
return false;
} elseif (empty($value) && !$this->is_required()) {
$this->set_as_valid();
return true;
} elseif(empty($value) && $this->is_required() && !in_array( $item->get_status(), apply_filters( 'tainacan-status-require-validation', [
'publish',
'future',
'private'
] ) )) {
$this->set_as_valid();
return true;
} else {
return $this->set_as_valid();
}
} else {
return $this->set_as_valid();
}
}
$classMetadatumType = $metadatum->get_metadata_type_object();

View File

@ -500,26 +500,20 @@ class Item extends Entity {
public function _toHtml() {
$return = '';
$id = $this->get_id();
if ( $id ) {
$link = get_permalink( (int) $id );
if (is_string($link)) {
$return = "<a data-linkto='item' data-id='$id' href='$link'>";
$return.= $this->get_title();
$return .= "</a>";
}
}
return $return;
}
/**
@ -725,7 +719,7 @@ class Item extends Entity {
}
$output .= $_embed;
} elseif ( $type == 'text' ) {
$output .= $this->get_document();
$output .= '<article>' . $this->get_document() . '</article>';
} elseif ( $type == 'attachment' ) {
if ( wp_attachment_is_image($this->get_document()) ) {

View File

@ -168,7 +168,7 @@ class Metadatum extends Entity {
/**
* Return the an object child of \Tainacan\metadatum_Types\Metadata_Type with options
*
* @return \Tainacan\Metadata_Types\Metadata_Type The metadatum type class with filled options
* @return \Tainacan\Metadata_Types\Metadata_Type|Object The metadatum type class with filled options
*/
function get_metadata_type_object(){
$class_name = $this->get_metadata_type();

View File

@ -45,7 +45,7 @@ class Taxonomy extends Entity {
static $db_identifier_prefix = 'tnc_tax_';
public function __toString() {
return apply_filters("tainacan-taxonomy-to-string", $this->get_name(), $this);
return (string) apply_filters("tainacan-taxonomy-to-string", $this->get_name(), $this);
}
/**
@ -54,18 +54,19 @@ class Taxonomy extends Entity {
* @return bool
*/
function tainacan_register_taxonomy() {
$taxonomy_name = $this->get_name();
$labels = array(
'name' => $this->get_name(),
'singular_name' => $this->get_name(),
'search_items' => __( sprintf('Search terms in %s', $this->get_name()), 'tainacan' ),
'all_items' => __( sprintf('All terms in %s', $this->get_name()), 'tainacan' ),
'name' => $taxonomy_name,
'singular_name' => $taxonomy_name,
'search_items' => __( sprintf('Search terms in %s', $taxonomy_name), 'tainacan' ),
'all_items' => __( sprintf('All terms in %s', $taxonomy_name), 'tainacan' ),
'parent_item' => __( 'Parent term', 'tainacan' ),
'parent_item_colon' => __( 'Parent term:', 'tainacan' ),
'edit_item' => __( 'Edit term', 'tainacan' ),
'update_item' => __( 'Update term', 'tainacan' ),
'add_new_item' => __( 'Add New term', 'tainacan' ),
'new_item_name' => __( 'New Genre term', 'tainacan' ),
'menu_name' => $this->get_name(),
'menu_name' => $taxonomy_name,
);
$enabled_post_types = $this->get_enabled_post_types();
@ -88,8 +89,6 @@ class Taxonomy extends Entity {
unregister_taxonomy($this->get_db_identifier());
}
register_taxonomy(
$this->get_db_identifier(),
$enabled_post_types,

View File

@ -52,7 +52,7 @@ class Term extends Entity {
}
public function __toString() {
return apply_filters("tainacan-term-to-string", $this->get_name(), $this);
return (string) apply_filters("tainacan-term-to-string", $this->get_name(), $this);
}
public function _toArray() {
@ -245,25 +245,19 @@ class Term extends Entity {
}
public function _toHtml() {
$return = '';
$id = $this->get_id();
if ( $id ) {
$link = get_term_link( (int) $id );
if (is_string($link)) {
$return = "<a data-linkto='term' data-id='$id' href='$link'>";
$return.= $this->get_name();
$return .= "</a>";
}
}
return apply_filters('tainacan-term-to-html', $return, $this);
}
}

View File

@ -60,6 +60,19 @@ class CSV extends Exporter {
$line[] = $rel;
} elseif ($meta->get_metadatum()->get_metadata_type() == 'Tainacan\Metadata_Types\Compound') {
$line[] = $this->get_compound_metadata_cell($meta);
} elseif ($meta->get_metadatum()->get_metadata_type() == 'Tainacan\Metadata_Types\Date' ) {
$metadatum = $meta->get_metadatum();
$date_value = 'ERROR ON FORMATING DATE';
if (is_object($metadatum)) {
$fto = $metadatum->get_metadata_type_object();
if (is_object($fto)) {
if ( method_exists($fto, 'get_value_as_html') ) {
$fto->output_date_format = 'Y-m-d';
$date_value = $fto->get_value_as_html($meta);
}
}
}
$line[] = $date_value;
} else {
$line[] = $meta->get_value_as_string();
}

View File

@ -193,7 +193,8 @@ abstract class Exporter {
$current_collection_item = $this->get_current_collection_item();
$collections = $this->get_collections();
$collection = $collections[$current_collection];
$current_collection_item ++;
$length_items = $this->get_step_length_items();
$current_collection_item += $length_items;
$this->set_current_collection_item($current_collection_item);
if ($current_collection_item >= $collection['total_items']) {
return $this->next_collection();
@ -248,6 +249,10 @@ abstract class Exporter {
return $this->current_collection_item;
}
public function get_step_length_items() {
return apply_filters('exporter_step_length_items', 20, $this->get_current_step());
}
public function set_current_collection_item($value) {
$this->current_collection_item = $value;
}
@ -350,11 +355,11 @@ abstract class Exporter {
}
public function add_log($message ) {
$this->log[] = $message;
$this->log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function add_error_log($message ) {
$this->error_log[] = $message;
$this->error_log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function is_finished() {
@ -562,20 +567,19 @@ abstract class Exporter {
$this->add_error_log('Collection misconfigured');
return false;
}
$this->add_log('Processing item ' . $current_collection_item);
$length_items = $this->get_step_length_items();
$this->add_log("Processing batch with $length_items items, starting from item $current_collection_item");
$this->process_header($current_collection_item, $collection_definition);
$init = microtime(true);
$processed_items = $this->get_items($current_collection_item, $collection_definition);
foreach ($processed_items as $processed_item) {
$init = microtime(true);
$this->process_item( $processed_item['item'], $processed_item['metadata'] );
}
$final = microtime(true);
$total = ($final - $init);
$time_log = sprintf( __('Processed in %f seconds', 'tainacan'), $total );
$this->add_log($time_log);
}
$this->process_footer($current_collection_item, $collection_definition);
return $this->next_item();
@ -595,7 +599,7 @@ abstract class Exporter {
}
private function process_footer($current_collection_item, $collection_definition) {
if ($current_collection_item == $collection_definition['total_items']-1) {
if ($current_collection_item > $collection_definition['total_items']) {
$this->output_footer();
}
}
@ -608,15 +612,16 @@ abstract class Exporter {
private function get_items($index, $collection_definition) {
$collection_id = $collection_definition['id'];
$tainacan_items = \Tainacan\Repositories\Items::get_instance();
$per_page = $this->get_step_length_items();
$page = intdiv($index, $per_page) + 1;
$filters = [
'posts_per_page' => 1,
'paged' => $index+1,
'posts_per_page' => $per_page,
'paged' => $page,
'order' => 'DESC',
'orderby' => 'ID'
];
$this->add_log('Proccessing item index ' . $index . ' in collection ' . $collection_definition['id'] );
$this->add_log("Retrieving $per_page items on page index: $index, in collection " . $collection_definition['id'] );
$items = $tainacan_items->fetch($filters, $collection_id, 'WP_Query');
if ( !isset($collection_definition['total_items']) ) {
@ -805,7 +810,7 @@ abstract class Exporter {
if (method_exists($this, $method_name)) {
$author = $this->get_transient('author');
$this->add_log('User in process: ' . $author . ' (' . date("Y-m-d H:i:s") . ')');
$this->add_log('User in process: ' . $author);
wp_set_current_user($author);
$result = $this->$method_name();
} else {

View File

@ -146,11 +146,11 @@ abstract class Generic_Process {
}
public function add_log($message ) {
$this->log[] = $message;
$this->log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function add_error_log($message ) {
$this->error_log[] = $message;
$this->error_log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function is_finished() {

View File

@ -12,7 +12,8 @@ class CSV extends Importer {
'delimiter' => ',',
'multivalued_delimiter' => '||',
'encode' => 'utf8',
'enclosure' => ''
'enclosure' => '',
'escape_empty_value' => '[empty value]'
]);
}
@ -385,6 +386,31 @@ class CSV extends Importer {
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label"><?php _e('Empty value', 'tainacan'); ?></label>
<span class="help-wrapper">
<a class="help-button has-text-secondary">
<span class="icon is-small">
<i class="tainacan-icon tainacan-icon-help" ></i>
</span>
</a>
<div class="help-tooltip">
<div class="help-tooltip-header">
<h5><?php _e('Empty value', 'tainacan'); ?></h5>
</div>
<div class="help-tooltip-body">
<p><?php _e('The string representing a value not informed for the metadata. (e.g. \EMPTY)', 'tainacan'); ?></p>
</div>
</div>
</span>
<div class="control is-clearfix">
<input class="input" type="text" name="escape_empty_value" value="<?php echo $this->get_option('escape_empty_value'); ?>">
</div>
</div>
</div>
</div>
<div class="columns">
@ -677,14 +703,13 @@ class CSV extends Importer {
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
// $Tainacan_Items->disable_logs();
// $Tainacan_Metadata->disable_logs();
// $Tainacan_Item_Metadata->disable_logs();
$itemMetadataArray = [];
$updating_item = false;
$Tainacan_Items->disable_logs();
$Tainacan_Metadata->disable_logs();
$Tainacan_Item_Metadata->disable_logs();
if ( is_numeric($this->get_transient('item_id')) ) {
$item = $Tainacan_Items->fetch( (int) $this->get_transient('item_id') );
@ -739,7 +764,9 @@ class CSV extends Importer {
if ($metadatum instanceof Entities\Metadatum) {
$singleItemMetadata = new Entities\Item_Metadata_Entity( $item, $metadatum); // *empty item will be replaced by inserted in the next foreach
if( $metadatum->get_metadata_type() == 'Tainacan\Metadata_Types\Taxonomy' ) {
if ($this->is_clear_value($values)) {
$singleItemMetadata->set_value("");
} else if( $metadatum->get_metadata_type() == 'Tainacan\Metadata_Types\Taxonomy' ) {
if( !is_array( $values ) ) {
$tmp = $this->insert_hierarchy( $metadatum, $values);
if ($tmp !== false) {
@ -787,7 +814,8 @@ class CSV extends Importer {
$this->add_error_log( $item->get_errors() );
return false;
}
global $wpdb;
$wpdb->query( 'SET autocommit = 0;' );
foreach ( $itemMetadataArray as $itemMetadata ) {
if($itemMetadata instanceof Entities\Item_Metadata_Entity ) {
$itemMetadata->set_item( $insertedItem ); // *I told you
@ -826,6 +854,8 @@ class CSV extends Importer {
// $this->add_error_log( 'Item ' . $insertedItem->get_id() . ' has an error' );
//}
}
$wpdb->query( 'COMMIT;' );
$wpdb->query( 'SET autocommit = 1;' );
if ( ! $updating_item ) {
$insertedItem->set_status('publish' );
@ -872,6 +902,16 @@ class CSV extends Importer {
}
}
/**
* @param $value
* @return bool
*/
private function is_clear_value($value) {
if( !empty($value) && is_array($value) )
return false;
return $this->get_option('escape_empty_value') == $value;
}
/**
* @param $metadatum the metadata
* @param $values the categories names

View File

@ -345,10 +345,10 @@ abstract class Importer {
* @param $messagelog
*/
public function add_log($message ) {
$this->log[] = $message;
$this->log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function add_error_log($message ) {
$this->error_log[] = $message;
$this->error_log[] = ['datetime' => date("Y-m-d H:i:s"), 'message' => $message];
}
public function add_collection(array $collection) {
@ -893,7 +893,6 @@ abstract class Importer {
$author = $this->get_transient('author');
$this->add_log('---------------------------');
$this->add_log('Starting processing new item');
$this->add_log(date("Y-m-d H:i:s"));
$this->add_log('User in process: ' . $author);
wp_set_current_user($author);
$result = $this->$method_name();

View File

@ -226,6 +226,7 @@
$this->debug('process already running');
return true;
}
$this->debug('process not already running');
return false;
}
@ -241,10 +242,11 @@
$this->debug('locking process: ' . $this->identifier);
$this->start_time = time(); // Set start time of current process.
$max_execution_time = ini_get('max_execution_time');
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : ( empty($max_execution_time) ? 60 : $max_execution_time ); // 1 minute
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : ( empty($max_execution_time) ? 60 : ($max_execution_time * 1.5) ); // 1 minute
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
$this->process_lock_in_time = microtime();
if(!$this->is_process_running())
set_site_transient( $this->identifier . '_process_lock', $this->process_lock_in_time, $lock_duration );
}
/**

View File

@ -303,10 +303,9 @@ class Collections extends Repository {
* @see \Tainacan\Repositories\Repository::insert()
*/
public function insert( $collection ) {
$this->pre_process( $collection );
$this->handle_parent_order_clone( $collection );
$new_collection = parent::insert( $collection );
$this->handle_core_metadata( $new_collection );
@ -389,12 +388,9 @@ class Collections extends Repository {
}
function pre_process( $collection ) {
$this->old_collection = $this->fetch( $collection->get_id() );
$this->old_core_title = $collection->get_core_title_metadatum();
$this->old_core_description = $collection->get_core_description_metadatum();
}
function handle_core_metadata( $collection ) {

View File

@ -25,7 +25,7 @@ class Item_Metadata extends Repository {
}
/**
* @param Entities\Entity $item_metadata
* @param Entities\Item_Metadata_Entity $item_metadata
*
* @return Entities\Entity|Entities\Item_Metadata_Entity
* @throws \Exception
@ -40,8 +40,6 @@ class Item_Metadata extends Repository {
do_action( 'tainacan-pre-insert', $item_metadata );
do_action( 'tainacan-pre-insert-Item_Metadata_Entity', $item_metadata );
$new = $item_metadata->get_value();
$unique = ! $item_metadata->is_multiple();
$metadata_type = $item_metadata->get_metadatum()->get_metadata_type_object();
@ -70,14 +68,14 @@ class Item_Metadata extends Repository {
return $item_metadata;
} else {
if ( $unique ) {
$item_metadata_value = $this->sanitize_value( $item_metadata->get_value() );
if ( !is_numeric($item_metadata->get_value()) && empty( $item_metadata->get_value() ) ) {
if ( $item_metadata->get_metadatum()->get_parent() > 0 )
delete_metadata_by_mid( 'post', $item_metadata->get_meta_id() );
else
delete_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id() );
} elseif ( is_int( $item_metadata->get_meta_id() ) ) {
update_metadata_by_mid( 'post', $item_metadata->get_meta_id(), $item_metadata->get_value() );
update_metadata_by_mid( 'post', $item_metadata->get_meta_id(), $item_metadata_value );
} else {
/**
@ -87,10 +85,10 @@ class Item_Metadata extends Repository {
* and not update an existing. This is the case of a multiple compound metadatum.
*/
if ( $item_metadata->get_metadatum()->get_parent() > 0 && is_null( $item_metadata->get_meta_id() ) ) {
$added_meta_id = add_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $item_metadata->get_value() ) );
$added_meta_id = add_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $item_metadata_value ) );
$added_compound = $this->add_compound_value( $item_metadata, $added_meta_id );
} else {
update_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $item_metadata->get_value() ) );
update_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $item_metadata_value ) );
}
}
@ -105,7 +103,8 @@ class Item_Metadata extends Repository {
if ( !is_numeric($value) && empty($value) ) {
continue;
}
add_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $value ) );
$item_metadata_value = $this->sanitize_value( $value );
add_post_meta( $item_metadata->get_item()->get_id(), $item_metadata->get_metadatum()->get_id(), wp_slash( $item_metadata_value ) );
}
}
}
@ -142,7 +141,7 @@ class Item_Metadata extends Repository {
$set_method = 'set_' . $metadata_type->get_related_mapped_prop();
$value = $item_metadata->get_value();
$item->$set_method( is_array( $value ) ? $value[0] : $value );
$item->$set_method( $this->sanitize_value( is_array( $value ) ? $value[0] : $value ) );
if ( $item->validate_core_metadata() ) {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
@ -185,6 +184,7 @@ class Item_Metadata extends Repository {
$insert[] = $exists->term_id;
} else {
$create_term = new Entities\Term();
$new_term = $this->sanitize_value($new_term);
$create_term->set_name($new_term);
$create_term->set_taxonomy( $taxonomy->get_db_identifier() );
if ($create_term->validate()) { // Item_Metadata Entity was validated before, so this should be fine

View File

@ -529,7 +529,7 @@ class Items extends Repository {
if($item != false && $item instanceof Entities\Item) {
$collection = $item->get_collection();
if( $collection->get_allow_comments() !== 'open' ) return false;
if( $collection != null && $collection->get_allow_comments() !== 'open' ) return false;
}
return $open_comment;

View File

@ -260,6 +260,10 @@ class Logs extends Repository {
$collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default';
if ( method_exists($entity, 'get_repository') && !$entity->get_repository()->use_logs ) {
return;
}
if ( $entity instanceof Entities\Collection ) {
$collection_id = $entity->get_id();
$log->set_title( sprintf( __( 'New file was attached to Collection "%s"', 'tainacan'), $entity->get_name() ) );
@ -272,15 +276,11 @@ class Logs extends Repository {
$object_type = get_class($entity);
$object_id = $entity->get_id();
$diff = [];
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
$log->set_action('new-attachment');
$title = __( sprintf('') , 'tainacan');
$prepared = [
'id' => $attachment->ID,
'title' => $attachment->post_title,
@ -313,7 +313,9 @@ class Logs extends Repository {
$entity = Repository::get_entity_by_post( $entity_post );
if ( $entity ) {
if ( method_exists($entity, 'get_repository') && !$entity->get_repository()->use_logs ) {
return;
}
$collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default';
$log = new Entities\Log();

View File

@ -304,7 +304,6 @@ class Metadata extends Repository {
}
}
/**
* fetch metadatum based on ID or WP_Query args
*
@ -676,7 +675,6 @@ class Metadata extends Repository {
);
}
/**
* That function update the core metadatum meta key, in case of changing the collection parent
*
@ -1001,7 +999,6 @@ class Metadata extends Repository {
return false;
}
/**
* create a metadatum entity and insert by an associative array ( attribute => value )
*
@ -1026,7 +1023,6 @@ class Metadata extends Repository {
}
}
/**
* Return all possible values for a metadatum
*

View File

@ -6,7 +6,6 @@ use Tainacan\Entities;
use Tainacan\Entities\Entity;
use Tainacan;
use Tainacan\Repositories;
use \Respect\Validation\Validator as v;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
@ -122,17 +121,13 @@ abstract class Repository {
*/
public function insert( $obj ) {
// validate
if ( in_array( $obj->get_status(), apply_filters( 'tainacan-status-require-validation', [
'publish',
'future',
'private'
] ) ) && ! $obj->get_validated() ) {
$required_validation_statuses = ['publish', 'future', 'private'];
if (in_array( $obj->get_status(), apply_filters( 'tainacan-status-require-validation', $required_validation_statuses) ) && ! $obj->get_validated() ) {
throw new \Exception( 'Entities must be validated before you can save them' );
// TODO: Throw Warning saying you must validate object before insert()
}
$is_update = false;
$old = '';
$diffs = [];
do_action( 'tainacan-pre-insert', $obj );
@ -141,8 +136,7 @@ abstract class Repository {
do_action( "tainacan-pre-insert-$obj_post_type", $obj );
$map = $this->get_map();
// First iterate through the native post properties
// First iterate through native post properties
foreach ( $map as $prop => $mapped ) {
if ( $mapped['map'] != 'meta' && $mapped['map'] != 'meta_multi' ) {
$obj->WP_Post->{$mapped['map']} = $obj->get_mapped_property( $prop );
@ -157,7 +151,11 @@ abstract class Repository {
$obj->WP_Post->post_status = 'publish';
}
$sanitized_title = $this->sanitize_value($obj->get('name'));
$sanitized_desc = $this->sanitize_value($obj->get('description'));
if ( $obj instanceof Entities\Item ) {
$sanitized_title = $this->sanitize_value($obj->get('title'));
// get collection to determine post type
$collection = $obj->get_collection();
@ -171,8 +169,15 @@ abstract class Repository {
do_action( "tainacan-pre-insert-$obj_post_type", $obj );
}
// TODO verificar se salvou mesmo
if ( ! $obj instanceof Entities\Log ) {
$obj->WP_Post->post_title = $sanitized_title;
$obj->WP_Post->post_content = $sanitized_desc;
}
$id = wp_insert_post( $obj->WP_Post );
if ($id instanceof \WP_Error || 0 === $id) {
return false;
}
// reset object
$obj->WP_Post = get_post( $id );
@ -250,10 +255,12 @@ abstract class Repository {
}
function maybe_add_slashes( $value ) {
if ( is_string( $value ) && strpos( $value, '\\' ) !== false ) {
return wp_slash( $value );
if ( is_string( $value ) ) {
if( strpos( $value, '\\' ) !== false ) {
return wp_slash( $this->sanitize_value($value) );
}
return $this->sanitize_value($value);
}
return $value;
}
@ -911,6 +918,16 @@ abstract class Repository {
}
protected function sanitize_value($content) {
if (is_numeric($content) || empty($content) ) {
return $content;
}
$allowed_html = wp_kses_allowed_html('post');
unset($allowed_html["a"]);
return trim(wp_kses($content, $allowed_html));
}
}
?>

View File

@ -141,7 +141,6 @@ class Taxonomies extends Repository {
* @return Entities\Entity
*/
public function insert( $taxonomy ) {
$new_taxonomy = parent::insert( $taxonomy );
$new_taxonomy->tainacan_register_taxonomy();
@ -168,7 +167,6 @@ class Taxonomies extends Repository {
* @return \WP_Query|Array an instance of wp query OR array of entities;
*/
public function fetch( $args = [], $output = null ) {
// TODO: Pegar taxonomias registradas via código
if ( is_numeric( $args ) ) {

View File

@ -17,17 +17,11 @@ use \Tainacan\Repositories;
* Optional. Array or string of arguments.
*
* @type mixed $metadata Metadatum object, ID or slug to retrieve only one metadatum. empty returns all metadata
*
* @type array $metadata__in Array of metadata IDs or Slugs to be retrieved. Default none
*
* @type array $metadata__not_in Array of metadata IDs (slugs not accepted) to excluded. Default none
*
* @type bool $exclude_title Exclude the Core Title Metadata from result. Default false
*
* @type bool $exclude_description Exclude the Core Description Metadata from result. Default false
*
* @type bool $exclude_core Exclude Core Metadata (title and description) from result. Default false
*
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
* Default: true
* @type string $before String to be added before each metadata block
@ -71,16 +65,53 @@ function tainacan_the_metadata($args = array()) {
* Return the item document as a HTML string to be used as output.
*
* @param int|string $item_id (Optional) The item ID. Default is the global $post
* @param string $img_size (Optional) The image size, in case of an imagen document. Default is 'large'
*
* @return string The HTML output
*/
function tainacan_get_the_document($item_id = 0) {
function tainacan_get_the_document($item_id = 0, $img_size = 'large') {
$item = tainacan_get_item($item_id);
if (!$item)
return;
return apply_filters('tainacan-get-the-document', $item->get_document_as_html(), $item);
return apply_filters('tainacan-get-the-document', $item->get_document_as_html($item_id, $img_size), $item);
}
/**
* To be used inside The Loop
*
* Return the item document in raw form (ID if an Attachment, textual content if URL or Text)
*
* @param int|string $item_id (Optional) The item ID. Default is the global $post
*
* @return string The raw output
*/
function tainacan_get_the_document_raw($item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return;
return apply_filters('tainacan_get_the_document_raw', $item->get_document($item_id), $item);
}
function tainacan_get_the_item_document_url($item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return;
return apply_filters('tainacan_get_the_item_document_url', $item->get_document_download_url(), $item);
}
function tainacan_get_the_document_type($item_id = 0) {
$item = tainacan_get_item($item_id);
if (!$item)
return;
return apply_filters('tainacan_get_the_document_type', $item->get_document_type(), $item);
}
function tainacan_the_item_document_download_link($item_id = 0) {
@ -112,10 +143,19 @@ function tainacan_the_document() {
echo tainacan_get_the_document();
}
/**
* To be used inside The Loop
*
* echoes HTML display-ready version of an attachment
*/
function tainacan_get_single_attachment_as_html($attachment_id, $item_id = 0, $img_size = 'large') {
echo tainacan_get_attachment_as_html($attachment_id, $item_id, $img_size);
}
/**
* Return HTML display-ready version of an attachment
*/
function tainacan_get_single_attachment_as_html($attachment_id, $item_id = 0) {
function tainacan_get_attachment_as_html($attachment_id, $item_id = 0, $img_size = 'large') {
$item = tainacan_get_item($item_id);
@ -123,7 +163,7 @@ function tainacan_get_single_attachment_as_html($attachment_id, $item_id = 0) {
return '';
}
echo $item->get_attachment_as_html($attachment_id);
return $item->get_attachment_as_html($attachment_id, $img_size);
}
/**
@ -219,6 +259,335 @@ function tainacan_the_collection_description() {
echo tainacan_get_the_collection_description();
}
/**
* Tainacan Gallery component, used to render document, attachments and other files
*
* @return string
*/
function tainacan_the_media_component($media_id, $media_items_thumbs, $media_items_main, $args) {
echo tainacan_get_the_media_component($media_id, $media_items_thumbs, $media_items_main, $args);
}
/**
* Tainacan Media Gallery component, used to render document, attachments and other files
*
* @param string $media_id ID to be added to the gallery div. If both main and thumbnail items are passed, each div ID will be posfixed with '-main' or '-thumbs'.
* @param array $media_items_thumbs Array of media items to be rendered inside smaller the carousel. Default to empty array
* @param array $media_items_main Array of media items to be rendered inside main, bigger the carousel. Default to empty array
* @param array|string $args {
* Optional. Array of arguments.
* @type string before_main_div String to be added before the main gallery div
* @type string after_main_div String to be added after the main gallery div
* @type string before_thumbs_div String to be added before the thumbs gallery div
* @type string after_thumbs_div String to be added after the thumbs gallery div
* @type string before_main_ul String to be added before the main gallery ul
* @type string after_main_ul String to be added after the main gallery ul
* @type string before_thumbs_ul String to be added before the thumbs gallery ul
* @type string after_thumbs_ul String to be added after the thumbs gallery ul
* @type string class_main_div Class to be added to the main gallery div
* @type string class_main_ul Class to be added to the main gallery ul
* @type string class_main_li Class to be added to the main gallery li
* @type string class_thumbs_div Class to be added to the thumbs gallery div
* @type string class_thumbs_ul Class to be added to the thumbs gallery ul
* @type string class_thumbs_li Class to be added to the thumbs gallery li
* @type array swiper_main_options Object with SwiperJS options for the main gallery
* @type array swiper_thumbs_options Object with SwiperJS options for the thumb gallery
* @type bool show_share_button Shows share button on lightbox
* }
* @return string
*/
function tainacan_get_the_media_component(
$media_id = 'tainacan-media-component',
$media_items_thumbs = array(),
$media_items_main = array(),
$args = array()
) {
global $TAINACAN_BASE_URL;
$args = array_merge(array(
'before_main_div' => '',
'after_main_div' => '',
'before_thumbs_div' => '',
'after_thumbs_div' => '',
'before_main_ul' => '',
'after_main_ul' => '',
'before_thumbs_ul' => '',
'after_thumbs_ul' => '',
'class_main_div' => '',
'class_main_ul' => '',
'class_main_li' => '',
'class_thumbs_div' => '',
'class_thumbs_ul' => '',
'class_thumbs_li' => '',
'swiper_main_options' => [],
'swiper_thumbs_options' => [],
'show_share_button' => false
), $args);
$args['has_media_main'] = $media_items_main && is_array($media_items_main) && count($media_items_main);
$args['has_media_thumbs'] = $media_items_thumbs && is_array($media_items_thumbs) && count($media_items_thumbs);
$args['media_main_id'] = $media_id . '-main';
$args['media_thumbs_id'] = $media_id . '-thumbs';
$args['media_id'] = $media_id;
if ( $args['has_media_main'] || $args['has_media_thumbs'] ) :
// Modal lightbox layer for rendering photoswipe
add_action('wp_footer', 'tainacan_get_the_media_modal_layer');
wp_enqueue_style( 'tainacan-media-component', $TAINACAN_BASE_URL . '/assets/css/media-component.css', array(), TAINACAN_VERSION);
wp_enqueue_script( 'tainacan-media-component', $TAINACAN_BASE_URL . '/assets/js/media_component.js', ['tainacan-search','wp-i18n'], TAINACAN_VERSION, true );
?>
<div class="tainacan-media-component">
<?php if ( $args['has_media_main'] ) : ?>
<!-- Slider main container -->
<?php echo $args['before_main_div'] ?>
<div id="<?php echo $args['media_main_id'] ?>" class="tainacan-media-component__swiper-main swiper-container <?php echo $args['class_main_div'] ?>">
<!-- Additional required wrapper -->
<?php echo $args['before_main_ul'] ?>
<ul class="swiper-wrapper <?php echo $args['class_main_ul'] ?>">
<?php foreach($media_items_main as $media_item) { ?>
<li class="swiper-slide <?php echo $args['class_main_li'] ?>">
<?php echo $media_item ?>
</li>
<?php }; ?>
</ul>
<?php echo $args['before_main_ul'] ?>
<?php if ( $args['swiper_main_options'] && isset($args['swiper_main_options']['pagination']) ) : ?>
<!-- If we need pagination -->
<div class="swiper-pagination swiper-pagination_<?php echo $args['media_main_id'] ?>"></div>
<?php endif; ?>
<?php if ( $args['swiper_main_options'] && isset($args['swiper_main_options']['navigation']) ) : ?>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev swiper-navigation-prev_<?php echo $args['media_main_id'] ?>"></div>
<div class="swiper-button-next swiper-navigation-next_<?php echo $args['media_main_id'] ?>"></div>
<?php endif; ?>
</div>
<?php echo $args['after_main_div'] ?>
<?php endif; ?>
<?php if ( $args['has_media_thumbs'] ) : ?>
<!-- Slider thumbs container -->
<?php echo $args['before_thumbs_div'] ?>
<div id="<?php echo $args['media_thumbs_id'] ?>" class="tainacan-media-component__swiper-thumbs swiper-container <?php echo $args['class_thumbs_div'] ?>">
<!-- Additional required wrapper -->
<?php echo $args['before_thumbs_ul'] ?>
<ul class="swiper-wrapper <?php echo $args['class_thumbs_ul'] ?>">
<?php foreach($media_items_thumbs as $media_item) { ?>
<li class="swiper-slide <?php echo $args['class_thumbs_li'] ?>">
<?php echo $media_item ?>
</li>
<?php }; ?>
</ul>
<?php echo $args['before_thumbs_ul'] ?>
<?php if ( $args['swiper_thumbs_options'] && isset($args['swiper_thumbs_options']['pagination']) ) : ?>
<!-- If we need pagination -->
<div class="swiper-paginations swiper-pagination_<?php echo $args['media_thumbs_id'] ?>"></div>
<?php endif; ?>
<?php if ( $args['swiper_thumbs_options'] && isset($args['swiper_thumbs_options']['navigation']) ) : ?>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev swiper-navigation-prev_<?php echo $args['media_thumbs_id'] ?>"></div>
<div class="swiper-button-next swiper-navigation-next_<?php echo $args['media_thumbs_id'] ?>"></div>
<?php endif; ?>
<!-- These elements will create a gradient on the side of the carousel -->
<div class="swiper-start-border"></div>
<div class="swiper-end-border"></div>
</div>
<?php echo $args['after_thumbs_div'] ?>
<?php endif; ?>
</div>
<?php if ( isset( $_REQUEST['wp_customize'] ) ) : ?>
<script>
tainacan_plugin.tainacan_media_components = (typeof tainacan_plugin != undefined && typeof tainacan_plugin.tainacan_media_components != "undefined") ? tainacan_plugin.tainacan_media_components : {};
tainacan_plugin.tainacan_media_components['<?php echo $args['media_id'] ?>'] = <?php echo json_encode($args) ?>;
</script>
<?php else :
wp_add_inline_script( 'tainacan-media-component', '
tainacan_plugin.tainacan_media_components = (typeof tainacan_plugin != undefined && typeof tainacan_plugin.tainacan_media_components != "undefined") ? tainacan_plugin.tainacan_media_components : {};
tainacan_plugin.tainacan_media_components["' . $args['media_id'] . '"] = '. json_encode($args) . ';
', 'before' );
endif; ?>
<?php endif; ?> <!-- End of if ($args['has_media_main'] || $args['has_media_thumbs'] ) -->
<?php
}
/**
* Tainacan Media Item for the Media Gallery component, used to render a single link displayed in the carousel
*
* @param array|string $args {
* Optional. Array of arguments.
* @type string before_slide_content String to be added before the slide-content div or a tag
* @type string after_slide_content String to be added after the slide-content div or a tag
* @type string class_slide_content Class to be added to the slide-content div or a tag
* @type string before_slide_metadata String to be added before the slide-metadata div
* @type string after_slide_metadata String to be added after the slide-metadata div
* @type string class_slide_metadata Class to be added to the slide-metadata div
* @type string media_content The content of the slide itself, such as an image, audio, video or iframe tag. It may be wrapped by a link to the full content
* @type string media_content_full The media full content, either an image, an html
* @type string media_title The media title, if available
* @type string media_description The media description, if available
* @type string media_caption The media caption, if available
* @type string media_type The media type or mime_type, used to render an icon if media_content is empty
* }
* @return string
*/
function tainacan_get_the_media_component_slide( $args = array() ) {
$args = array_merge(array(
'before_slide_content' => '',
'after_slide_content' => '',
'class_slide_content' => '',
'before_slide_metadata' => '',
'after_slide_metadata' => '',
'class_slide_metadata' => '',
'media_content' => '',
'media_content_full' => '',
'media_title' => '',
'media_description' => '',
'media_caption' => '',
'media_type' => ''
), $args);
ob_start();
?>
<?php echo $args['before_slide_content'] ?>
<div class="swiper-slide-content <?php echo $args['class_slide_content'] ?>">
<?php if ( isset($args['media_content']) && !empty($args['media_content']) && $args['media_content'] !== false ) :?>
<?php echo $args['media_content'] ?>
<?php else: ?>
<img src="<?php echo tainacan_get_the_mime_type_icon($args['media_type']) ?>" alt="<?php echo ( !empty($args['media_title']) ? $args['media_title'] : __('File', 'tainacan') ) ?>" >
<?php endif; ?>
<?php echo $args['before_slide_metadata'] ?>
<?php if ( !empty($args['media_title']) || !empty($args['description']) || !empty($args['media_caption']) ) : ?>
<div class="swiper-slide-metadata <?php echo $args['class_slide_metadata'] ?>">
<?php if ( !empty($args['media_caption']) ) :?>
<span class="swiper-slide-metadata__caption">
<?php echo $args['media_caption'] ?>
<br>
</span>
<?php endif; ?>
<?php if ( !empty($args['media_title']) ) :?>
<span class="swiper-slide-metadata__name">
<?php echo $args['media_title'] ?>
</span>
<?php endif; ?>
<br>
<?php if ( !empty($args['media_description']) ) :?>
<span class="swiper-slide-metadata__description">
<?php echo $args['media_description'] ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( !empty($args['media_content_full']) ) : ?>
<div class="media-full-content" style="display: none; position: absolute; visibility: hidden;"><?php echo $args['media_content_full'] ?></div>
<?php endif; ?>
<?php echo $args['after_slide_metadata'] ?>
</div>
<?php echo $args['after_slide_content'] ?>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/**
* Div with content necessay to render the photowipe modal
*
* @return string
*/
function tainacan_get_the_media_modal_layer() {
?>
<!-- Root element of PhotoSwipe lightbox. Must have class pswp. -->
<div class="tainacan-photoswipe-layer pswp" tabindex="-1" role="dialog" aria-hidden="true">
<!-- Background of PhotoSwipe.
It's a separate element, as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<!-- Container that holds slides. PhotoSwipe keeps only 3 slides in DOM to save memory. -->
<!-- don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<div class="pswp__name"></div>
<button class="pswp__button pswp__button--close" title="<?php __('Close modal (Esc)', 'tainacan') ?>"></button>
<button class="pswp__button pswp__button--share" title="<?php __('Share', 'tainacan') ?>"></button>
<button class="pswp__button pswp__button--fs" title="<?php __('Toggle fullscreen', 'tainacan') ?>"></button>
<button class="pswp__button pswp__button--zoom" title="<?php __('Zoom in/out', 'tainacan') ?>"></button>
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="<?php __('Next', 'tainacan') ?>"></button>
<button class="pswp__button pswp__button--arrow--right" title="<?php __('Previous', 'tainacan') ?>"></button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
<?php
}
/**
* When visiting a collection archive or single, returns the collection url link
@ -545,3 +914,86 @@ function tainacan_get_initials($string, $one = false) {
$result = strtoupper($first . $second);
return apply_filters('tainacan-get-initials', $result, $string, $one);
}
/**
* Gets the icon mime type using our custom plugin thumbnails
*
* @param string $mime_type The mime_type or type of the file
* @param string $image_size The image size
*
* @return string
*/
function tainacan_get_the_mime_type_icon($mime_type, $image_size = 'medium') {
global $TAINACAN_BASE_URL;
$images_path = $TAINACAN_BASE_URL . '/assets/images/';
$icon_file = '';
switch($image_size) {
case 'full':
case 'large':
case 'tainacan-large-full':
$image_size = '';
break;
case 'small':
case 'tainacan-small':
case 'thumbnail':
$image_size = '_small';
break;
case '':
case 'medium':
case 'tainacan-medium':
case 'tainacan-medium-full':
case 'medium_large':
default:
$image_size = '_medium';
}
switch($mime_type) {
case 'image':
case 'image/png':
case 'image/jpeg':
case 'image/gif':
case 'image/bmp':
case 'image/webp':
case 'image/svg+xml':
$icon_file = 'placeholder_image';
break;
case 'audio':
case 'audio/midi':
case 'audio/mpeg':
case 'audio/mp3':
case 'audio/webm':
case 'audio/ogg':
case 'audio/wav':
$icon_file = 'placeholder_audio';
break;
case 'text':
case 'text/plain':
case 'text/html':
case 'text/css':
case 'text/javascript':
case 'text/csv':
$icon_file = 'placeholder_text';
break;
case 'video':
case 'video/webm':
case 'video/ogg':
case 'video/mpeg':
case 'video/mp4':
$icon_file = 'placeholder_video';
break;
case 'url':
$icon_file = 'placeholder_url';
break;
case 'application/pdf':
$icon_file = 'placeholder_pdf';
break;
case 'attachment':
case 'empty':
default:
$icon_file = 'placeholder_attachment';
}
return $images_path . $icon_file . $image_size . '.png';
}

View File

@ -36,6 +36,19 @@ trait Entity_Collection_Relation {
if($this->collection instanceof Entities\Collection){
return $this->collection;
}
} else {
$post = get_post($this->get_id());
if (!$post || !$post->post_type)
return null;
$post_type = $post->post_type;
$matches = array();
$regex = '/' . Collection::$db_identifier_prefix . '([a-zA-Z0-9_]*)' . Collection::$db_identifier_sufix . '/';
preg_match($regex, $post_type, $matches);
$collection_id = $matches[1];
if (is_numeric($collection_id)) {
$this->set_collection_id($collection_id);
return $this->get_collection();
}
}
return null;

View File

@ -1,5 +1,5 @@
=== Tainacan ===
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
Tested up to: 5.6

View File

@ -2,7 +2,7 @@
/*
Plugin Name: Tainacan
Plugin URI: https://tainacan.org/
Description: Open source, powerfull 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 respository 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
Version: 0.17.4
Text Domain: tainacan

View File

@ -63,6 +63,8 @@
v-if="filterTypeOptions.type == 'year'"
:placeholder="$i18n.get('instruction_type_value_year')"
:aria-labelledby="'filter-label-id-' + filter.id"
:aria-minus-label="$i18n.get('label_decrease')"
:aria-plus-label="$i18n.get('label_increase')"
size="is-small"
step="1"
@input="emitOnlyYear($event)"

View File

@ -2,6 +2,8 @@
<div>
<b-numberinput
:aria-labelledby="'filter-label-id-' + filter.id"
:aria-minus-label="$i18n.get('label_decrease')"
:aria-plus-label="$i18n.get('label_increase')"
size="is-small"
@input="($event) => { resetPage(); validadeValues($event) }"
:step="filterTypeOptions.step"
@ -14,6 +16,8 @@
</p>
<b-numberinput
:aria-labelledby="'filter-label-id-' + filter.id"
:aria-minus-label="$i18n.get('label_decrease')"
:aria-plus-label="$i18n.get('label_increase')"
size="is-small"
@input="($event) => { resetPage(); validadeValues($event) }"
:step="filterTypeOptions.step"

View File

@ -62,6 +62,8 @@
<b-numberinput
:aria-labelledby="'filter-label-id-' + filter.id"
:aria-minus-label="$i18n.get('label_decrease')"
:aria-plus-label="$i18n.get('label_increase')"
size="is-small"
:step="Number(filterTypeOptions.step)"
@input="($event) => { resetPage($event); emit($event); }"

View File

@ -196,35 +196,45 @@ class Compound extends Metadata_Type {
foreach ( $compound_element as $meta_id => $meta ) {
$index = array_search( $meta_id, array_column( $order, 'id' ) );
if ( $meta instanceof Item_Metadata_Entity && $meta->get_value_as_html() != '' ) {
$html = $this->get_meta_html($meta);
if ( $index !== false ) {
$metadata_value[$index] = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
$metadata_value[$index] = $html;
} else {
$metadata_value_not_ordinate[] = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
$metadata_value_not_ordinate[] = $html;
}
}
}
$elements[] = '<div class="tainacan-compound-metadatum">' . implode("\n", array_merge($metadata_value, $metadata_value_not_ordinate)) . "</div> \n" ;
}
}
$return = '<div class="tainacan-compound-group">' . implode($separator, $elements) . '</div>';
$return = implode($separator, $elements);
} else {
$metadata_value = array_fill(0, count($value), null);
$metadata_value_not_ordinate = [];
foreach ( $value as $meta_id => $meta ) {
$index = array_search( $meta_id, array_column( $order, 'id' ) );
if ( $meta instanceof Item_Metadata_Entity && $meta->get_value_as_html() != '' ) {
$html = $this->get_meta_html($meta);
if ( $index !== false ) {
$metadata_value[intval($index)] = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
$metadata_value[intval($index)] = $html;
} else {
$metadata_value_not_ordinate[] = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
$metadata_value_not_ordinate[] = $html;
}
}
}
$return = '<div class="tainacan-compound-group">' . implode("\n", array_merge($metadata_value, $metadata_value_not_ordinate)) . "</div> \n";
$return = implode("\n", array_merge($metadata_value, $metadata_value_not_ordinate));
}
return $return;
return "<div class='tainacan-compound-group'> {$return} </div>";
}
private function get_meta_html(Item_Metadata_Entity $meta) {
$html = '';
if ($meta instanceof Item_Metadata_Entity && !empty($meta->get_value_as_html())) {
$html = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
}
return $html;
}
}

View File

@ -25,6 +25,7 @@ class Date extends Metadata_Type {
</div>
</div>
');
$this->output_date_format = get_option('date_format');
}
public function validate( Item_Metadata_Entity $item_metadata) {
@ -35,31 +36,19 @@ class Date extends Metadata_Type {
foreach ($value as $date_value) {
$d = \DateTime::createFromFormat($format, $date_value);
if (!$d || $d->format($format) !== $date_value) {
$this->add_error(
sprintf(
__('Invalid date format. Expected format is YYYY-MM-DD, got %s.', 'tainacan'),
$date_value
)
);
$this->add_error($this->format_error_msg($date_value));
return false;
}
}
return True;
return true;
}
$d = \DateTime::createFromFormat($format, $value);
if (!$d || $d->format($format) !== $value) {
$this->add_error(
sprintf(
__('Invalid date format. Expected format is YYYY-MM-DD, got %s.', 'tainacan'),
$value
)
);
$this->add_error($this->format_error_msg($value));
return false;
}
return true;
}
/**
@ -80,20 +69,30 @@ class Date extends Metadata_Type {
if( empty( $el ) )
continue;
$return .= $prefix;
$return .= mysql2date(get_option('date_format'), ($el));
$return .= $this->format_date_value($el);
$return .= $suffix;
$count ++;
if ($count < $total)
$return .= $separator;
}
} else {
$return = $this->format_date_value($value);
}
return $return;
}
private function format_date_value($value) {
if (empty($value))
return "";
$return = mysql2date(get_option('date_format'), ($value));
}
return $return;
return mysql2date($this->output_date_format, ($value));
}
private function format_error_msg($value) {
return sprintf(
__('Invalid date format. Expected format is MM/DD/YYYY, got %s.', 'tainacan'),
$value
);
}
}

View File

@ -37,5 +37,4 @@ class Numeric extends Metadata_Type {
]
];
}
}

View File

@ -158,13 +158,10 @@ class Relationship extends Metadata_Type {
* @return string The HTML representation of the value, containing one or multiple items names, linked to the item page
*/
public function get_value_as_html(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$return = '';
if ( $item_metadata->is_multiple() ) {
$count = 1;
$total = sizeof($value);
$prefix = $item_metadata->get_multivalue_prefix();
@ -172,66 +169,47 @@ class Relationship extends Metadata_Type {
$separator = $item_metadata->get_multivalue_separator();
foreach ( $value as $item_id ) {
try {
//$item = new \Tainacan\Entities\Item($item_id);
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$item = $Tainacan_Items->fetch( (int) $item_id);
$count++;
if ( $item instanceof \Tainacan\Entities\Item ) {
$return .= $prefix;
$return .= $this->get_item_html($item);
$return .= $suffix;
if ( $count <= $total ) {
$return .= $separator;
}
}
} catch (\Exception $e) {
// item not found
}
}
} else {
try {
$item = new \Tainacan\Entities\Item($value);
if ( $item instanceof \Tainacan\Entities\Item ) {
$return .= $this->get_item_html($item);
}
} catch (\Exception $e) {
// item not found
}
}
return $return;
}
private function get_item_html($item) {
$return = '';
$id = $item->get_id();
$search_meta_id = $this->get_option('search');
if ( $id && $search_meta_id ) {
$link = get_permalink( (int) $id );
$search_meta_id = $this->get_option('search');
@ -250,17 +228,13 @@ class Relationship extends Metadata_Type {
}
if (is_string($link)) {
$return = "<a data-linkto='item' data-id='$id' href='$link'>";
$return.= $label;
$return .= "</a>";
}
}
return $return;
}
/**
@ -268,7 +242,6 @@ class Relationship extends Metadata_Type {
* @return \Tainacan\Entities\Collection|false The Collection object or false
*/
public function get_collection() {
$collection_id = $this->get_option('collection_id');
if ( is_numeric($collection_id) ) {
@ -279,7 +252,6 @@ class Relationship extends Metadata_Type {
}
return false;
}
/**

View File

@ -323,7 +323,6 @@ class Taxonomy extends Metadata_Type {
}
return $valid;
}
/**
@ -332,13 +331,10 @@ class Taxonomy extends Metadata_Type {
* @return string The HTML representation of the value, containing one or multiple terms, separated by comma, linked to term page
*/
public function get_value_as_html(Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$return = '';
if ( $item_metadata->is_multiple() ) {
$count = 1;
$total = sizeof($value);
$prefix = $item_metadata->get_multivalue_prefix();
@ -346,7 +342,6 @@ class Taxonomy extends Metadata_Type {
$separator = $item_metadata->get_multivalue_separator();
foreach ( $value as $term ) {
$count++;
if ( is_integer($term) ) {
@ -355,35 +350,25 @@ class Taxonomy extends Metadata_Type {
if ( $term instanceof \Tainacan\Entities\Term ) {
$return .= $prefix;
$return .= $this->get_term_hierarchy_html($term);
$return .= $suffix;
if ( $count <= $total ) {
$return .= $separator;
}
}
}
} else {
if ( $value instanceof \Tainacan\Entities\Term ) {
$return .= $this->get_term_hierarchy_html($value);
}
}
return $return;
}
private function get_term_hierarchy_html( \Tainacan\Entities\Term $term ) {
$terms = [];
$terms[] = $this->term_to_html($term);
while ($term->get_parent() > 0) {
@ -392,11 +377,9 @@ class Taxonomy extends Metadata_Type {
}
$terms = \array_reverse($terms);
$glue = apply_filters('tainacan-terms-hierarchy-html-separator', '<span class="hierarchy-separator"> > </span>');
return \implode($glue, $terms);
}
private function term_to_html($term) {

View File

@ -50,6 +50,6 @@ class Text extends Metadata_Type {
} else {
$return = $this->make_clickable_links($value);
}
return $return;
return force_balance_tags($return);
}
}

View File

@ -59,6 +59,6 @@ class Textarea extends Metadata_Type {
} else {
$return = nl2br($this->make_clickable_links($value));
}
return $return;
return force_balance_tags($return);
}
}

View File

@ -39,6 +39,8 @@
:label="$i18n.get('label_number_of_copies') + ':'">
<b-numberinput
ref="copy-count-numerbinput"
:aria-minus-label="$i18n.get('label_decrease')"
:aria-plus-label="$i18n.get('label_increase')"
min="1"
:value="copyCount"
step="1"
@ -49,7 +51,7 @@
<footer class="modal-card-foot form-submit">
<button
type="submit"
class="button"
class="button is-outlined"
:disabled="isLoading"
@click="onConfirm(newItems); $parent.close();">
{{ hasCopied ? $i18n.get('label_return_to_list') : $i18n.get('cancel') }}

View File

@ -3,7 +3,13 @@
<div
class="is-inline-flex"
v-if="filterTags != undefined && filterTags.length > 0">
<p style="margin-bottom: 0;"><strong>{{ totalItems }}</strong>{{ ' itens encontrados, ' }}<strong>{{ filterTags.length }}</strong>{{ ' filtros aplicados: ' }}&nbsp;&nbsp;</p>
<p style="margin-bottom: 0;">
<strong>{{ totalItems }}</strong>
{{ ' ' + ( totalItems == 1 ? $i18n.get('info_item_found') : $i18n.get('info_items_found') ) + ', ' }}
<strong>{{ filterTags.length }}</strong>
{{ ' ' + ( filterTags.length == 1 ? $i18n.get('info_applied_filter') : $i18n.get('info_applied_filters') ) + ': ' }}
&nbsp;&nbsp;
</p>
<b-tag
v-for="(filterTag, index) of filterTags"
:key="index"

View File

@ -39,6 +39,7 @@ export const ThumbnailHelperFunctions = () => {
break;
case 'audio/midi':
case 'audio/mpeg':
case 'audio/mp3':
case 'audio/webm':
case 'audio/ogg':
case 'audio/wav':
@ -55,6 +56,7 @@ export const ThumbnailHelperFunctions = () => {
case 'video/webm':
case 'video/ogg':
case 'video/mpeg':
case 'video/mp4':
imageSrc = 'placeholder_video';
break;
case 'url':

View File

@ -281,6 +281,7 @@ class Admin {
'wp_ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => is_user_logged_in() ? wp_create_nonce( 'wp_rest' ) : false,
'components' => $components,
'classes' => array(),
'i18n' => $tainacan_admin_i18n,
'user_caps' => $user_caps,
'user_prefs' => $prefs,

View File

@ -8,31 +8,89 @@ function tainacan_blocks_initialize() {
global $wp_version;
if (is_plugin_active('gutenberg/gutenberg.php') || $wp_version >= '5') {
tainacan_blocks_add_gutenberg_blocks_actions();
}
}
function tainacan_blocks_add_gutenberg_blocks_actions() {
add_action('init', 'tainacan_blocks_get_common_styles');
add_action('init', 'tainacan_blocks_register_tainacan_terms_list');
add_action('init', 'tainacan_blocks_register_tainacan_items_list');
add_action('init', 'tainacan_blocks_register_tainacan_dynamic_items_list');
add_action('init', 'tainacan_blocks_register_tainacan_carousel_items_list');
add_action('init', 'tainacan_blocks_register_tainacan_carousel_terms_list');
add_action('init', 'tainacan_blocks_register_tainacan_search_bar');
add_action('init', 'tainacan_blocks_register_tainacan_faceted_search');
add_action('init', 'tainacan_blocks_register_tainacan_collections_list');
add_action('init', 'tainacan_blocks_register_tainacan_carousel_collections_list');
add_action('init', 'tainacan_blocks_register_tainacan_facets_list');
add_action('init', 'tainacan_blocks_register_tainacan_item_submission_form');
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
add_action('init', 'tainacan_blocks_add_plugin_settings', 90);
add_action('init', 'tainacan_blocks_add_plugin_admin_settings', 90);
add_action('init', 'register_tainacan_blocks_add_gutenberg_blocks');
add_action('wp_enqueue_scripts', 'unregister_taiancan_blocks');
add_action('admin_enqueue_scripts', 'unregister_taiancan_blocks');
}
}
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
add_action('init', 'tainacan_blocks_register_category_icon');
function register_tainacan_blocks_add_gutenberg_blocks() {
tainacan_blocks_get_common_styles();
tainacan_blocks_register_category_icon();
tainacan_blocks_register_tainacan_terms_list();
tainacan_blocks_register_tainacan_search_bar();
tainacan_blocks_register_tainacan_items_list();
tainacan_blocks_register_tainacan_facets_list();
tainacan_blocks_register_tainacan_faceted_search();
tainacan_blocks_register_tainacan_collections_list();
tainacan_blocks_register_tainacan_dynamic_items_list();
tainacan_blocks_register_tainacan_carousel_items_list();
tainacan_blocks_register_tainacan_carousel_terms_list();
tainacan_blocks_register_tainacan_item_submission_form();
tainacan_blocks_register_tainacan_carousel_collections_list();
}
function unregister_taiancan_blocks() {
global $post;
if(!$post) return;
$not_allowed = apply_filters('posts-names-to-unregister-taiancan-blocks', []);
$current_page = $post->post_name;
if ( in_array($current_page, $not_allowed) ) {
wp_deregister_script('items-list');
wp_deregister_script('terms-list');
wp_deregister_script('facets-list');
wp_deregister_script('search-bar');
wp_deregister_script('faceted-search');
wp_deregister_script('tainacan-search');
wp_deregister_script('collections-list');
wp_deregister_script('facets-list-theme');
wp_deregister_script('dynamic-items-list');
wp_deregister_script('carousel-items-list');
wp_deregister_script('carousel-terms-list');
wp_deregister_script('item-submission-form');
wp_deregister_script('google-recaptcha-script');
wp_deregister_script('search-bar-theme-script');
wp_deregister_script('tainacan-item-submission');
wp_deregister_script('dynamic-items-list-theme');
wp_deregister_script('carousel-collections-list');
wp_deregister_script('carousel-items-list-theme');
wp_deregister_script('carousel-terms-list-theme');
wp_deregister_script('carousel-collections-list-theme');
wp_deregister_script('tainacan-blocks-register-category-icon');
wp_deregister_style('terms-list');
wp_deregister_style('items-list');
wp_deregister_style('search-bar');
wp_deregister_style('facets-list');
wp_deregister_style('faceted-search');
wp_deregister_style('collections-list');
wp_deregister_style('dynamic-items-list');
wp_deregister_style('carousel-items-list');
wp_deregister_style('carousel-terms-list');
wp_deregister_style('item-submission-form');
wp_deregister_style('carousel-collections-list');
wp_deregister_style('tainacan-blocks-common-styles');
wp_deregister_style('tainacan-blocks-register-category-icon');
if (function_exists('unregister_block_type')) {
unregister_block_type('tainacan/terms-list');
unregister_block_type('tainacan/items-list');
unregister_block_type('tainacan/search-bar');
unregister_block_type('tainacan/facets-list');
unregister_block_type('tainacan/faceted-search');
unregister_block_type('tainacan/collections-list');
unregister_block_type('tainacan/dynamic-items-list');
unregister_block_type('tainacan/carousel-items-list');
unregister_block_type('tainacan/carousel-terms-list');
unregister_block_type('tainacan/item-submission-form');
unregister_block_type('tainacan/carousel-collections-list');
}
}
}
function tainacan_blocks_register_categories($categories, $post){

View File

@ -322,6 +322,8 @@
top: 0px;
justify-content: center;
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -95,7 +95,9 @@
right: -14px;
top: 0px;
justify-content: center;
z-index: 999
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -121,7 +121,8 @@ registerBlockType('tainacan/collections-list', {
key={ collection.id }
className="collection-list-item"
style={{ marginBottom: layout == 'grid' ? (showName ? gridMargin + 12 : gridMargin) + 'px' : ''}}>
{ tainacan_blocks.wp_version < '5.4' ?
{
tainacan_blocks.wp_version < '5.4' ?
<IconButton
onClick={ () => removeCollectionOfId(collection.id) }
icon="no-alt"
@ -130,6 +131,7 @@ registerBlockType('tainacan/collections-list', {
<Button
onClick={ () => removeCollectionOfId(collection.id) }
icon="no-alt"
showTooltip={false}
label={__('Remove', 'tainacan')} />
}
<a
@ -156,7 +158,7 @@ registerBlockType('tainacan/collections-list', {
setAttributes({
content: (
<ul
style={{ gridTemplateColumns: layout == 'grid' ? 'repeat(auto-fill, ' + (gridMargin + (showName ? 220 : 185)) + 'px)' : 'inherit' }}
style={{ gridTemplateColumns: layout == 'grid' ? ('repeat(auto-fill, ' + (gridMargin + (showName ? 220 : 185)) + 'px)') : 'inherit' }}
className={'collections-list collections-layout-' + layout + (!showName ? ' collections-list-without-margin' : '')}>
{ selectedCollectionsHTML }
</ul>

View File

@ -294,6 +294,8 @@
top: 0px;
justify-content: center;
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -135,6 +135,7 @@ registerBlockType('tainacan/items-list', {
<Button
onClick={ () => removeItemOfId(item.id) }
icon="no-alt"
showTooltip={false}
label={__('Remove', 'tainacan')}/>
}
<a

View File

@ -101,6 +101,8 @@
top: 0px;
justify-content: center;
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -241,6 +241,7 @@ export default class ItemsModal extends React.Component {
className="wp-block-tainacan-modal dynamic-modal"
title={ __('Select items to add on block', 'tainacan', 'tainacan')}
onRequestClose={ () => this.cancelSelection() }
shouldCloseOnClickOutside={ false }
contentLabel={ __('Select items that will be added on block', 'tainacan', 'tainacan')}>
<iframe
id="itemsFrame"

View File

@ -322,6 +322,8 @@
top: 0px;
justify-content: center;
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -128,6 +128,7 @@ registerBlockType('tainacan/terms-list', {
<Button
onClick={ () => removeTermOfId(term.id) }
icon="no-alt"
showTooltip={false}
label={__('Remove', 'tainacan')}/>
}
<a

View File

@ -77,7 +77,9 @@
right: -14px;
top: 0px;
justify-content: center;
z-index: 999
z-index: 999;
.dashicon { margin: 0px; }
}
&:hover button {

View File

@ -0,0 +1,421 @@
// TAINACAN MEDIA COMPONENT --------------------------------------------------------
//
// Counts on some HMTL markup to make a list of media links be displayed
// as a carousel with a lightbox. Check examples in the end of the file
import PhotoSwipe from 'photoswipe/dist/photoswipe.min.js';
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default.min.js';
const { __ } = wp.i18n;
tainacan_plugin.classes.TainacanMediaGallery = class TainacanMediaGallery {
/**
* Constructor initializes the instance. Options are Snake Case because they come from PHP side
* @param {String} thumbs_gallery_selector html element to be queried containing the thumbnails list
* @param {String} main_gallery_selector html element to be queried containing the main list
* @param {Object} options several options to be tweaked
* @param {Object} options.swiper_thumbs_options object with SwiperJS options for the thumbnails list (https://swiperjs.com/swiper-api)
* @param {Object} options.swiper_main_options object with SwiperJS options for the main list
* @param {Boolean} options.show_share_button show share button on lightbox
*
* @return {Object} TainacanMediaGallery instance
*/
constructor(thumbs_gallery_selector, main_gallery_selector, options) {
this.thumbs_gallery_selector = thumbs_gallery_selector;
this.main_gallery_selector = main_gallery_selector;
this.thumbsSwiper = null;
this.mainSwiper = null;
this.options = options;
this.initializeSwiper();
if (this.main_gallery_selector)
this.initPhotoSwipeFromDOM(this.main_gallery_selector + " .swiper-wrapper");
else if (this.thumbs_gallery_selector)
this.initPhotoSwipeFromDOM(this.thumbs_gallery_selector + " .swiper-wrapper");
}
/* Initializes Swiper JS instances of carousels */
initializeSwiper() {
if (this.thumbs_gallery_selector) {
let thumbsSwiperOptions = {
spaceBetween: 12,
slidesPerView: 'auto',
navigation: {
nextEl: '.swiper-navigation-next_' + this.thumbs_gallery_selector,
prevEl: '.swiper-navigation-prev_' + this.thumbs_gallery_selector,
},
pagination: {
el: '.swiper-pagination_' + this.thumbs_gallery_selector
},
centerInsufficientSlides: true,
watchOverflow: true,
a11y: {
prevSlideMessage: __( 'Previous slide', 'tainacan'),
nextSlideMessage: __( 'Next slide', 'tainacan'),
firstSlideMessage: __('This is the first slide', 'tainacan'),
lastSlideMessage: __('This is the last slide', 'tainacan')
},
};
thumbsSwiperOptions = {...thumbsSwiperOptions, ...this.options.swiper_thumbs_options };
this.thumbsSwiper = new Swiper(this.thumbs_gallery_selector, thumbsSwiperOptions);
}
if (this.main_gallery_selector) {
let mainSwiperOptions = {
slidesPerView: 1,
slidesPerGroup: 1,
// navigation: {
// nextEl: '.swiper-navigation-next_' + this.main_gallery_selector,
// prevEl: '.swiper-navigation-prev_' + this.main_gallery_selector,
// },
// pagination: {
// el: '.swiper-pagination_' + this.main_gallery_selector
// },
watchOverflow: true,
a11y: {
prevSlideMessage: __( 'Previous slide', 'tainacan'),
nextSlideMessage: __( 'Next slide', 'tainacan'),
firstSlideMessage: __('This is the first slide', 'tainacan'),
lastSlideMessage: __('This is the last slide', 'tainacan')
},
};
if (this.thumbsSwiper) {
mainSwiperOptions.thumbs = {
swiper: this.thumbsSwiper,
autoScrollOffset: 3
}
}
mainSwiperOptions = {...mainSwiperOptions, ...this.options.swiper_main_options };
this.mainSwiper = new Swiper(this.main_gallery_selector, mainSwiperOptions);
}
if (this.thumbsMain && this.mainSwiper) {
this.mainSwiper.controller = {
control: this.thumbsSwiper,
by: 'slide'
}
}
}
initPhotoSwipeFromDOM (gallerySelector) {
// loop through all gallery elements and bind events
let galleryElement = document.querySelector(gallerySelector);
galleryElement.setAttribute("data-pswp-uid", this.options.media_id);
galleryElement.onclick = (event) => this.onThumbnailsClick(event, this);
// Parse URL and open gallery if it contains #&pid=3&gid=1
let hashData = this.photoswipeParseHash();
if (hashData.pid && hashData.gid)
this.openPhotoSwipe(hashData.pid, galleryElement, true, true);
}
// parse slide data (url, title, size ...) from DOM elements
// (children of gallerySelector)
parseThumbnailElements(el) {
let items = [];
const galleryElements = el.childNodes;
// Crossbrowser safe way to traverse nodeList
Array.prototype.forEach.call(galleryElements, (liElement) => {
// Include only element nodes
if (liElement.nodeType === 1) {
let item = {};
let fullContentElement = liElement.querySelectorAll('.media-full-content *');
if ( !fullContentElement.length ) {
item = {
html: fullContentElement.outerHTML ? fullContentElement.outerHTML : fullContentElement
}
} else {
if (fullContentElement[fullContentElement.length - 1].nodeName === 'IMG') {
fullContentElement = fullContentElement[fullContentElement.length - 1];
item = {
src: fullContentElement.src,
w: parseInt(fullContentElement.width),
h: parseInt(fullContentElement.height)
};
} else {
fullContentElement = fullContentElement[0];
item = {
html: fullContentElement.outerHTML ? fullContentElement.outerHTML : fullContentElement
}
}
}
let metadataElement = liElement.querySelector('.swiper-slide-metadata');
if (metadataElement) {
const name = metadataElement.querySelector('.swiper-slide-metadata__name');
const caption = metadataElement.querySelector('.swiper-slide-metadata__caption');
const description = metadataElement.querySelector('.swiper-slide-metadata__description');
item.title = {
name,
caption,
description
}
} else {
item.title = false;
}
item.el = liElement; // save link to element for getThumbBoundsFn
items.push(item);
}
});
return items;
};
openPhotoSwipe(
index,
galleryElement,
disableAnimation,
fromURL
) {
let pswpElement = document.querySelectorAll(".pswp")[0],
gallery,
options,
items;
items = this.parseThumbnailElements(galleryElement);
// Photoswipe options
// https://photoswipe.com/documentation/options.html //
options = {
showHideOpacity: true,
loop: false,
timeToIdle: 6000,
timeToIdleOutside: 3000,
closeEl: true,
captionEl: true,
fullscreenEl: true,
zoomEl: true,
counterEl: true,
arrowEl: true,
preloaderEl: true,
shareEl: this.options.show_share_button ? this.options.show_share_button : false,
bgOpacity: 1,
// define gallery index (for URL)
galleryUID: galleryElement.getAttribute("data-pswp-uid"),
getThumbBoundsFn: (index) => {
let thumbnail = items[index].el,
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
rect = thumbnail.getBoundingClientRect();
return { x: rect.left, y: rect.top + pageYScroll, w: rect.width };
},
// Function builds caption markup
addCaptionHTMLFn: (item, captionEl, isFake) => {
// item - slide object
// captionEl - caption DOM element
// isFake - true when content is added to fake caption container
// (used to get size of next or previous caption)
captionEl.children[0].innerHTML = '';
if(!item.title)
return false;
if (item.title.caption)
captionEl.children[0].innerHTML += '<span class="pswp__figure_caption">' + item.title.caption.innerHTML + '</span>';
if (item.title.name && item.title.caption || (!item.title.name && item.title.caption && item.title.description) )
captionEl.children[0].innerHTML += '<br>';
if (item.title.name)
captionEl.children[0].innerHTML += '<span class="pswp__name">' + item.title.name.innerHTML + '</span>';
if (item.title.description && item.title.name)
captionEl.children[0].innerHTML += '<br>';
if (item.title.description)
captionEl.children[0].innerHTML += '<span class="pswp__description">' + item.title.description.innerHTML + '</span>';
return true;
},
};
// PhotoSwipe opened from URL
if (fromURL) {
if (options.galleryPIDs) {
// parse real index when custom PIDs are used
// http://photoswipe.com/documentation/faq.html#custom-pid-in-url
for (let j = 0; j < items.length; j++) {
if (items[j].pid == index) {
options.index = j;
break;
}
}
} else {
// in URL indexes start from 1
options.index = parseInt(index, 10) - 1;
}
} else {
options.index = parseInt(index, 10);
}
// exit if index not found
if (isNaN(options.index))
return;
if (disableAnimation)
options.showAnimationDuration = 0;
// Pass data to PhotoSwipe and initialize it
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
/* Updates PhotoSwiper instance from Swiper */
let swiperInstance = this.mainSwiper ? this.mainSwiper : this.thumbsSwiper;
gallery.listen("unbindEvents", () => {
// This is index of current photoswipe slide
let getCurrentIndex = gallery.getCurrentIndex();
// Update position of the slider
swiperInstance.slideTo(getCurrentIndex, 0, false);
// Start swiper autoplay (on close - if swiper autoplay is true)
if (swiperInstance.params && swiperInstance.params.autoplay && swiperInstance.params.autoplay.enabled)
swiperInstance.autoplay.start();
});
// Swiper autoplay stop when image zoom */
gallery.listen('initialZoomIn', () => {
if (swiperInstance.params && swiperInstance.params.autoplay && swiperInstance.params.autoplay.enabled && swiperInstance.autoplay.running)
swiperInstance.autoplay.stop();
});
};
// triggers when user clicks on thumbnail
onThumbnailsClick(e, self) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
let eTarget = e.target || e.srcElement;
// find root element of slide
let closest = function closest(el, fn) {
return el && (fn(el) ? el : closest(el.parentNode, fn));
};
let clickedListItem = closest(eTarget, function(el) {
return el.tagName && el.tagName.toUpperCase() === "LI";
});
if (!clickedListItem)
return;
// find index of clicked item by looping through all child nodes
// alternatively, you may define index via data- attribute
let clickedGallery = clickedListItem.parentNode,
childNodes = clickedListItem.parentNode.childNodes,
numChildNodes = childNodes.length,
nodeIndex = 0,
index;
for (let i = 0; i < numChildNodes; i++) {
if (childNodes[i].nodeType !== 1)
continue;
if (childNodes[i] === clickedListItem) {
index = nodeIndex;
break;
}
nodeIndex++;
}
// open PhotoSwipe if valid index found
if (index >= 0)
self.openPhotoSwipe(index, clickedGallery);
return false;
}
// parse picture index and gallery index from URL (#&pid=1&gid=2)
photoswipeParseHash() {
const hash = window.location.hash.substring(1),
params = {};
if (hash.length < 5)
return params;
const vars = hash.split("&");
for (let i = 0; i < vars.length; i++) {
if (!vars[i])
continue;
const pair = vars[i].split("=");
if (pair.length < 2)
continue;
params[pair[0]] = pair[1];
}
if (params.gid)
params.gid = parseInt(params.gid, 10);
return params;
}
}
/* Loads and instantiates media components passed to the global variable */
document.addEventListener('DOMContentLoaded', function() {
if (tainacan_plugin?.classes?.TainacanMediaGallery && tainacan_plugin?.tainacan_media_components) {
(Object.values(tainacan_plugin.tainacan_media_components) || []).forEach((component) => {
new tainacan_plugin.classes.TainacanMediaGallery(
component.has_media_thumbs ? '#' + component.media_thumbs_id : null,
component.has_media_main ? '#' + component.media_main_id : null,
component
);
});
}
});
/*
---- Carousel of thumbnails only ----------------------------------------
<div class="swiper-container-thumbs swiper-container">
<ul class="swiper-wrapper">
<li class="swiper-slide">
<a href="link-to-full-image-or-file">
<img href="link-to-thumbnail" alt..>
<span class="swiper-slide-name>File name</span>
</a>
</li>
</ul>
</div>
new TainacanMediaGallery(.swiper-container-thumbs, null, {...});
---- Carousel of thumbnails with main slider ----------------------------
<div class="swiper-container-main swiper-container">
<ul class="swiper-wrapper">
<li class="swiper-slide">
<a href="link-to-full-image-or-file">
<img href="link-to-medium-or-large" alt..>
<span class="swiper-slide-name>File name</span>
</a>
</li>
</ul>
</div>
<div class="swiper-container-thumbs swiper-container">
<ul class="swiper-wrapper">
<li class="swiper-slide">
<img href="link-to-thumbnail" alt..>
<span class="swiper-slide-name>File name</span>
</li>
</ul>
</div>
new TainacanMediaGallery(.swiper-container-thumbs, .swiper-container-main, {...});
*/

View File

@ -0,0 +1,381 @@
$pswp__show-hide-transition-duration: 333ms !default;
$pswp__controls-transition-duration: 333ms !default;
$pswp__background-color: rgba(0,0,0, 0.8) !default;
$pswp__placeholder-color: #222 !default;
$pswp__box-sizing-border-box: true !default; // disable .pswp * { box-sizing:border-box } (in case you already have it in your site css)
$pswp__root-z-index: 9999999 !default;
$pswp__assets-path: '../images/' !default; // path to skin assets folder (preloader, PNG and SVG sprite)
$pswp__error-text-color: #CCC !default; // "Image not loaded" text color
$pswp__include-minimal-style: true !default;
@import '../../../node_modules/photoswipe/src/css/main.scss';
@import '../../../node_modules/photoswipe/src/css/default-skin/default-skin.scss';
.tainacan-media-component {
--swiper-theme-color: var(--tainacan-secondary, #298596);
--swiper-navigation-size: 44px;
--tainacan-media-background: var(--tainacan-background-color, #ffffff);
--tainacan-media-main-carousel-height: 60vh;
--tainacan-media-main-carousel-width: 100%;
--tainacan-media-thumbs-carousel-width: 100%;
--tainacan-media-thumbs-carousel-item-size: 136px;
width: 100%;
height: auto;
display: block;
background-color: var(--tainacan-media-background, #ffffff);
}
/* Style valid for both cases of carousel, main and thumbs */
.tainacan-media-component__swiper-main,
.tainacan-media-component__swiper-thumbs {
.swiper-button-prev::after,
.swiper-container-rtl .swiper-button-next::after {
content: 'previous';
}
.swiper-button-next::after,
.swiper-button-prev::after {
font-family: "TainacanIcons";
opacity: 0.7;
transition: opacity ease 0.2s;
}
&:hover {
.swiper-button-next::after,
.swiper-button-prev::after {
opacity: 1;
}
}
ul.swiper-wrapper {
list-style: none;
padding: 0;
}
}
.tainacan-media-component__swiper-main {
width: 100%;
max-width: var(--tainacan-media-main-carousel-width, 100%);
ul.swiper-wrapper {
display: flex;
align-items: center;
margin-bottom: 30px;
&[data-pswp-uid] li.swiper-slide img {
cursor: zoom-in !important;
}
}
li.swiper-slide {
height: 100%;
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
min-width: 100%;
padding: 0 var(--swiper-navigation-size, 44px);
opacity: 1.0;
transition: opacity 0.2s linear;
&:not(.swiper-slide-active) {
opacity: 0.75;
}
.swiper-slide-metadata {
text-align: center;
&.hide-name .swiper-slide-metadata__name {
display: none;
visibility: hidden;
}
&.hide-description .swiper-slide-metadata__description {
display: none;
visibility: hidden;
}
&.hide-caption .swiper-slide-metadata__caption {
display: none;
visibility: hidden;
}
}
.swiper-slide-metadata__name {
font-size: 1em;
font-weight: bold;
color: var(--tainacan-label-color, #454647);
}
.swiper-slide-metadata__caption {
font-size: 0.9375em;
color: var(--tainacan-input-color, #1d1d1d);
}
.swiper-slide-metadata__caption {
font-size: 0.875em;
color: var(--tainacan-info-color, #555758);
}
}
.swiper-slide-content {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.tainacan-embed-container {
width: 100%;
height: auto;
}
iframe {
max-height: var(--tainacan-media-main-carousel-height, 60vh);
width: 100%;
max-width: 100%;
border: none;
display: block;
background-image: url('../images/preloader.gif');
background-repeat: no-repeat;
background-position: center;
}
a:first-of-type,
p:first-of-type {
z-index: 99;
background: var(--tainacan-media-background, #ffffff);
border-radius: 3px;
word-wrap: break-word;
}
audio {
background: black;
min-height: 38px;
border-radius: 20px;
width: 100%;
height: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh);
}
video {
min-height: 56px;
width: 100%;
height: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh);
}
img {
width: auto;
max-height: var(--tainacan-media-main-carousel-height, 60vh);
}
}
}
.tainacan-media-component__swiper-thumbs {
width: 100%;
max-width: var(--tainacan-media-thumbs-carousel-width, 100%);
ul.swiper-wrapper {
max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px));
margin: 0 var(--swiper-navigation-size, 44px);
margin-bottom: 30px;
}
li.swiper-slide {
text-align: center;
vertical-align: top;
word-break: break-all;
font-size: 0.875em;
max-width: calc(var(--tainacan-media-thumbs-carousel-item-size, 136px) + 17px);
cursor: zoom-in;
@media only screen and (max-width: 380px) {
margin: 10px 0;
}
img {
width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
height: var(--tainacan-media-thumbs-carousel-item-size, 136px);
max-width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
max-height: var(--tainacan-media-thumbs-carousel-item-size, 136px);
object-fit: cover;
object-position: center;
border-bottom-width: 6px;
border-bottom-style: solid;
background-color: var(--tainacan-media-background, #ffffff);
border-bottom-color: rgba(255,255,255, 0.0);
opacity: 0.85;
transition: opacity 0.3s ease, border-bottom-color 0.3s ease;
&:focus,
&:hover {
opacity: 0.95;
outline: none;
border-bottom-color: var(--swiper-theme-color, #298596);
}
}
&.swiper-slide-thumb-active {
.swiper-slide-metadata__name {
font-weight: bold;
}
img {
opacity: 1.0;
border-bottom-color: var(--swiper-theme-color, #298596);
}
}
.swiper-slide-metadata__name {
font-size: 1em;
color: var(--tainacan-label-color, #454647);
}
.swiper-slide-metadata__caption {
font-size: 0.9375em;
color: var(--tainacan-input-color, #1d1d1d);
}
.swiper-slide-metadata__caption {
font-size: 0.875em;
color: var(--tainacan-info-color, #555758);
}
.swiper-slide-metadata {
text-align: center;
display: block;
margin-top: 0.5rem;
&.hide-name .swiper-slide-metadata__name {
display: none;
visibility: hidden;
}
&.hide-description .swiper-slide-metadata__description {
display: none;
visibility: hidden;
}
&.hide-caption .swiper-slide-metadata__caption {
display: none;
visibility: hidden;
}
}
a {
width: 100%;
max-width: var(--tainacan-media-thumbs-carousel-item-size, 136px);
text-align: center;
word-break: break-word;
}
a,
a:focus,
a:hover {
outline: none;
text-decoration: none;
color: var(--tainacan-gray5, #454647);
}
}
.swiper-start-border {
position: absolute;
height: 100%;
width: calc(32px + var(--swiper-navigation-size, 44px));
background-image: linear-gradient(90deg, var(--tainacan-media-background, #ffffff) 25%, transparent);
top: 0;
left: 0;
z-index: 1;
}
.swiper-end-border {
position: absolute;
height: 100%;
width: calc(32px + var(--swiper-navigation-size, 44px));
background-image: linear-gradient(90deg, transparent, var(--tainacan-media-background, #ffffff) 75%);
top: 0;
right: 0;
z-index: 1;
}
}
.tainacan-media-component__swiper-main+.tainacan-media-component__swiper-thumbs {
li.swiper-slide {
cursor: pointer;
}
}
// Photoswip zoom ---------------------------------
.tainacan-photoswipe-layer {
.pswp__bg {
background-color: rgba(0, 0, 0, 0.85);
}
.pswp__ui--fit .pswp__top-bar,
.pswp__ui--fit .pswp__caption {
background-color: rgba(0, 0, 0, 0.7);
}
.pswp__button--arrow--left::before,
.pswp__button--arrow--right::before {
background-color: rgba(0, 0, 0, 0.5);
}
.pswp__container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.attachment-without-image {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
&.tainacan-embed-container:not(.tainacan-embed-without-iframe) {
padding: 0px;
}
.tainacan-embed-container .twitter-tweet {
width: 100vw !important;
}
}
iframe {
padding: 44px;
min-height: 90vh;
max-height: 90vh;
height: 100%;
width: 100%;
max-width: 100%;
margin: 0 auto;
border: none;
display: block;
background-image: url('../images/preloader.gif');
background-repeat: no-repeat;
background-position: center;
}
a:first-of-type,
p:first-of-type ,
article:first-of-type {
z-index: 99;
padding: 1rem 4.33337vw;
background: var(--tainacan-media-background, #ffffff);
border-radius: var(--borderRadius, 3px);
word-wrap: break-word;
}
audio {
background: black;
min-height: 38px;
border-radius: 20px;
}
video {
min-height: 56px;
}
}
.pswp__top-bar .pswp__name {
color: white;
text-align: center;
font-size: 1.125em;
display: block;
height: 44px;
max-width: calc(100% - 240px);
width: 100%;
left: 44px;
position: absolute;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 44px;
padding: 0 10px;
}
.pswp__figure_caption {
font-size: 0.875em;
font-style: italic;
}
.pswp__description {
font-size: 0.9375em;
}
.pswp__caption__center {
text-align: center;
font-size: 1em;
max-width: 800px;
}
}

View File

@ -574,6 +574,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_activitiy_per_user' => __( 'Activities per user', 'tainacan'),
'label_report_generated_on' => __( 'Report generated on', 'tainacan'),
'label_get_latest_report' => __( 'Get latest report', 'tainacan'),
'label_decrease' => __( 'Decrease', 'tainacan'),
'label_increase' => __( 'Increase', 'tainacan'),
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
@ -855,6 +857,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_recaptcha_link_%s' => __( 'Remember to configure your website reCAPTCHA keys on <a href="%s" target="_blank">the item submission repository page</a>.', 'tainacan'),
'info_form_not_loaded' => __( 'There are probably not enought permissions to display it here.', 'tainacan'),
'info_validating_slug' => __( 'Validating slug...', 'tainacan'),
'label_amount_of_metadata_of_type' => __( 'Amount of metadata of this type', 'tainacan'),
'info_child_terms_chart' => __( 'Click on the term bar on the chart aside to see its child terms (if any) in this panel', 'tainacan' ),
@ -871,6 +874,10 @@ return apply_filters( 'tainacan-admin-i18n', [
'action_delete-attachment' => __( 'Deletion of Attachments', 'tainacan'),
'action_update-thumbnail' => __( 'Thumbnail Updates', 'tainacan'),
'action_others' => __( 'Other Actions', 'tainacan'),
'info_applied_filters' => __( 'filters applied', 'tainacan'),
'info_items_found' => __( 'items found', 'tainacan'),
'info_applied_filter' => __( 'filter applied', 'tainacan'),
'info_item_found' => __( 'item found', 'tainacan'),
// Datepicker months
'datepicker_month_january' => __( 'January', 'tainacan' ),

View File

@ -48,7 +48,7 @@ import {
ThumbnailHelperPlugin
} from '../../admin/js/utilities';
document.addEventListener("DOMContentLoaded", () => {
function mountTainacanItemsListComponent() {
// Mount only if the div exists
if (document.getElementById('tainacan-items-page')) {
@ -247,4 +247,22 @@ document.addEventListener("DOMContentLoaded", () => {
// Options...
});
}
}
// Checks if document is loaded
const performWhenDocumentIsLoaded = callback => {
if (/comp|inter|loaded/.test(document.readyState))
cb();
else
document.addEventListener('DOMContentLoaded', callback, false);
}
// Mounts when page is loaded
performWhenDocumentIsLoaded(() => {
mountTainacanItemsListComponent();
});
// Also if a theme or plugin requested a reset...
document.addEventListener("TainacanReloadItemsListComponent", () => {
mountTainacanItemsListComponent();
});

View File

@ -79,7 +79,7 @@
}
}
.filters-menu:not(.filters-menu-modal) {
z-index: 99999;
z-index: 99;
float: left;
max-width: var(--tainacan-filter-menu-width-theme);
min-width: 154px;
@ -96,6 +96,7 @@
@media screen and (max-width: 768px) {
padding: 0;
z-index: 99999;
.modal-content {
top: 0;

View File

@ -1154,8 +1154,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
]);
$this->assertEquals(7, $bulk->count_posts());
}
/**
@ -1206,8 +1204,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
$item_id = $bulk->get_item_id_by_index(30);
$this->assertFalse($item_id);
}
function test_set_multiple_tax_meta() {
@ -1228,14 +1224,8 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
'collection_id' => $this->collection->get_id()
]);
$bulk->set_value($this->category, ['super', 'dooper']);
$items = $Tainacan_Items->fetch([
'tax_query' => [
[
@ -1342,6 +1332,4 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
$this->assertEquals(5, $items->found_posts);
}
}

View File

@ -16,7 +16,7 @@ SKIP_DB_CREATE=${7-false}
download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
curl -s -L "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi

View File

@ -2,6 +2,8 @@
namespace Tainacan\Tests\Factories;
use InvalidArgumentException;
class Entity_Factory {
/**
@ -9,6 +11,7 @@ class Entity_Factory {
* @var \Tainacan\Entities\Entity
*/
private $entity;
/**
*
* @var \Tainacan\Repositories\Repository
@ -28,19 +31,18 @@ class Entity_Factory {
*
* @param bool $publish
*
* @throws InvalidArgumentException
*
* @return mixed
* @throws \ErrorException
*/
public function create_entity($type, $args = [], $is_validated_and_in_db = false, $publish = false){
ini_set('display_errors', 1);
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
try {
$type = trim($type);
if(empty($type)){
throw new \InvalidArgumentException('The type can\'t be empty');
throw new InvalidArgumentException('The type can\'t be empty');
} elseif(!strrchr($type, '_')){
$type = ucfirst(strtolower($type));
} else {
@ -107,7 +109,7 @@ class Entity_Factory {
$this->entity->validate();
$this->entity = $this->repository->insert( $this->entity );
} else {
throw new \InvalidArgumentException('One or more arguments are invalid.');
throw new InvalidArgumentException('One or more arguments are invalid.');
}
} catch (\Exception $exception){
echo "\n" . $exception->getMessage() . "\n";
@ -116,5 +118,3 @@ class Entity_Factory {
return $this->entity;
}
}
?>

View File

@ -16,12 +16,10 @@ use Tainacan\Entities;
class BGProcess extends TAINACAN_UnitApiTestCase {
function test_table() {
global $wpdb;
$table_name = $wpdb->prefix . 'tnc_bg_process';
$table_exists = $wpdb->get_var( "SHOW TABLES LIKE '".$table_name."'" );
$this->assertNotEquals(null, $table_exists);
@ -29,10 +27,6 @@ class BGProcess extends TAINACAN_UnitApiTestCase {
$column_exists = $wpdb->get_var( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$wpdb->prefix}tnc_bg_process' AND column_name = 'output'" );
$this->assertEquals('output', $column_exists, 'BG processes table misconfigured');
}
}

View File

@ -79,10 +79,6 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
true
);
$term = $this->tainacan_entity_factory->create_entity(
'term',
array(
@ -237,10 +233,6 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
);
$this->assertContains($tax3->get_db_identifier(), get_object_taxonomies($collection->get_db_identifier()), 'Taxonommy used by repository level metadatum must be assigned to all collections post types');
}
function test_relate_taxonomy_match() {
@ -794,9 +786,6 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$checkMeta = $Tainacan_Metadata->fetch( $metadatum->get_id() );
$this->assertEquals('no', $checkMeta->get_metadata_type_options()['allow_new_terms']);
}
}

View File

@ -8,7 +8,7 @@ namespace Tainacan\Tests;
* @package Test_Tainacan
*/
use Tainacan\Entities;
use Tainacan\Entities\Item_Metadata_Entity;
/**
* Compound Metadatum Types test case.
@ -17,10 +17,7 @@ use Tainacan\Entities;
class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
function test_compound_metadata_types() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
@ -79,23 +76,21 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
true
);
$item_metadata1 = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata1 = new Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata1->set_value('Red');
$item_metadata1->validate();
$item_metadata1 = $Tainacan_Item_Metadata->insert($item_metadata1);
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata1->get_parent_meta_id());
$item_metadata = new Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata1->get_parent_meta_id());
$item_metadata->set_value('Blue');
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
$compoundItem = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
global $wpdb;
$compoundItem = new Item_Metadata_Entity($i, $metadatum);
$compoundValue = $compoundItem->get_value();
@ -105,17 +100,15 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertTrue( isset($compoundValue[$metadatum_child1->get_id()]), 'First element of value must be set' );
$this->assertTrue( isset($compoundValue[$metadatum_child2->get_id()]), 'Second element of value must be set' );
$this->assertTrue( $compoundValue[$metadatum_child1->get_id()] instanceof \Tainacan\Entities\Item_Metadata_Entity , 'First element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[$metadatum_child2->get_id()] instanceof \Tainacan\Entities\Item_Metadata_Entity , 'Second element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[$metadatum_child1->get_id()] instanceof Item_Metadata_Entity , 'First element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[$metadatum_child2->get_id()] instanceof Item_Metadata_Entity , 'Second element of value should be an item metadata entity' );
$this->assertEquals( 'Red', $compoundValue[$metadatum_child1->get_id()]->get_value() , 'First element of value should have "Red" value' );
$this->assertEquals( 'Blue', $compoundValue[$metadatum_child2->get_id()]->get_value() , 'Second element of value should have "Blue" value' );
}
function test_multiple_compound_metadata_types() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
@ -175,34 +168,30 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
true
);
global $wpdb;
// First Instance
$item_metadata1 = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata1 = new Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata1->set_value('Red');
$item_metadata1->validate();
$item_metadata1 = $Tainacan_Item_Metadata->insert($item_metadata1);
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata1->get_parent_meta_id());
$item_metadata = new Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata1->get_parent_meta_id());
$item_metadata->set_value('Blue');
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
// Second Instance
$item_metadata3 = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata3 = new Item_Metadata_Entity($i, $metadatum_child1);
$item_metadata3->set_value('Green');
$item_metadata3->validate();
$item_metadata3 = $Tainacan_Item_Metadata->insert($item_metadata3);
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata3->get_parent_meta_id());
$item_metadata = new Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata3->get_parent_meta_id());
$item_metadata->set_value('Yellow');
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
$compoundItem = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
//var_dump($wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = {$i->get_id()}"));
//var_dump($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE parent = {$metadatum->get_id()}"));
$compoundItem = new Item_Metadata_Entity($i, $metadatum);
$compoundValue = $compoundItem->get_value();
$this->assertTrue( is_array($compoundValue), 'value of a compound should return array' );
@ -214,8 +203,8 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertTrue( isset($compoundValue[0][$metadatum_child1->get_id()]), 'First element of value must be set' );
$this->assertTrue( isset($compoundValue[1][$metadatum_child2->get_id()]), 'Second element of value must be set' );
$this->assertTrue( $compoundValue[0][$metadatum_child1->get_id()] instanceof \Tainacan\Entities\Item_Metadata_Entity , 'First element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[1][$metadatum_child2->get_id()] instanceof \Tainacan\Entities\Item_Metadata_Entity , 'Second element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[0][$metadatum_child1->get_id()] instanceof Item_Metadata_Entity , 'First element of value should be an item metadata entity' );
$this->assertTrue( $compoundValue[1][$metadatum_child2->get_id()] instanceof Item_Metadata_Entity , 'Second element of value should be an item metadata entity' );
$this->assertEquals( 'Red', $compoundValue[0][$metadatum_child1->get_id()]->get_value() , 'First element of value should have "Red" value' );
$this->assertEquals( 'Blue', $compoundValue[0][$metadatum_child2->get_id()]->get_value() , 'Second element of value should have "Blue" value' );
@ -224,7 +213,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertEquals( 'Yellow', $compoundValue[1][$metadatum_child2->get_id()]->get_value() , 'Second element of value should have "Blue" value' );
$item_metadata_removed = $Tainacan_Item_Metadata->remove_compound_value($i, $metadatum, $item_metadata3->get_parent_meta_id());
$compoundItem = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
$compoundItem = new Item_Metadata_Entity($i, $metadatum);
$compoundValue = $compoundItem->get_value();
$this->assertTrue( is_array($compoundValue), 'value of a compound should return array' );
@ -232,13 +221,9 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertEquals( 'Red', $compoundValue[0][$metadatum_child1->get_id()]->get_value() , 'First element of value should have "Red" value' );
$this->assertEquals( 'Blue', $compoundValue[0][$metadatum_child2->get_id()]->get_value() , 'Second element of value should have "Blue" value' );
}
function test_validations_taxonomy_in_multiple() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
@ -308,9 +293,6 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
}
function test_validations_multiple_metadata() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
@ -343,15 +325,11 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase {
$newMetadatum->set_multiple('no');
$this->assertTrue($newMetadatum->validate());
}
function teste_validations_metadada_order() {
function test_validations_metadada_order() {
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(

View File

@ -14,7 +14,7 @@ namespace Tainacan\Tests;
class Filters extends TAINACAN_UnitTestCase {
function teste_add(){
function test_add(){
$Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(

View File

@ -0,0 +1,176 @@
<?php
namespace Tainacan\Tests;
/**
* Class TestCollections
*
* @package Test_Tainacan
*/
/**
* HTML INJECTION test case.
*/
class TAINACAN_HTML_Injection extends TAINACAN_UnitTestCase
{
// Evil attempts
private $link = "<a href='www.tainacan.org'>link</a>";
private $js = "<script>alert('XSS')</script>";
private $css = "my text along with some style <style>a { display: none }</style>";
private $iframe = "<iframe src='www.tainacan.org' title='Taiancan'></iframe>";
private $text_and_link = "";
private $text_and_iframe = "";
// Accepted formatting
private $strong = "I have some info to tell the world. And I can <strong> bold it </strong>";
private $html = "<div><h1>Main Info</h1><h3>sub title</h3><p>My structure description<p></p>and another paragraph</p></div>";
// Expected returns
private $expected_title = 'my very interesting name and link as well';
private $expected_desc = 'description item';
private $collection = null;
private $item = null;
private $metadatum = null;
private $taxonomy = null;
private $taxonomy_db = null;
public function setUp()
{
parent::setUp();
$link = $this->link;
$iframe = $this->iframe;
$this->text_and_link = "my very interesting name and $link as well";
$this->text_and_iframe = "description item $iframe";
$this->test_collections();
}
function test_collections() {
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'collection name <a href="www.tainacan.org">link <a href="link2.com.br"> link2 </a> </a>',
'description' => $this->text_and_iframe,
),
true
);
$collection = $Tainacan_Collections->fetch($collection->get_id());
$this->assertEquals($collection->get_name(), 'collection name link link2');
$this->assertEquals($collection->get_description(), $this->expected_desc);
$this->collection = $collection;
$this->test_items();
}
function test_items() {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$item = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'title item <script>console.log("XSS")</script>',
'description' => $this->text_and_iframe,
'collection' => $this->collection
),
true
);
$item = $Tainacan_Items->fetch($item->get_id());
$this->assertEquals($item->get_title(), 'title item console.log("XSS")');
$this->assertEquals($item->get_description(), $this->expected_desc);
$this->item = $item;
$this->test_metadata();
}
function test_metadata() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$metadatum = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => $this->text_and_link,
'description' => 'metadatum description',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Text',
),
true
);
$metadatum = $Tainacan_Metadata->fetch($metadatum->get_id());
$this->assertEquals($metadatum->get_name(), $this->expected_title);
$this->metadatum = $metadatum;
$this->test_taxonomies();
}
function test_taxonomies() {
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
$taxonomy = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => $this->text_and_link,
'collections' => [$this->collection],
'description' => $this->text_and_iframe,
'status' => 'publish'
),
true
);
$tx = $Tainacan_Taxonomies->fetch($taxonomy->get_id());
$this->assertEquals($tx->get_name(), $this->expected_title);
$this->assertEquals($tx->get_description(), $this->expected_desc);
$this->taxonomy = $taxonomy;
$this->taxonomy_db = $taxonomy->get_db_identifier();
}
function test_terms() {
$Tainacan_Terms = \Tainacan\Repositories\Terms::get_instance();
$term = $this->tainacan_entity_factory->create_entity(
'term',
array(
'taxonomy' => $this->taxonomy_db,
'name' => $this->css,
),
true
);
$t = $Tainacan_Terms->fetch($term->get_term_id(), $this->taxonomy);
$this->assertEquals($t->get_name(), 'my text along with some style');
}
function test_item_metadata() {
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($this->item, $this->metadatum);
$item_metadata->set_value($this->js);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
$this->assertEquals($item_metadata->get_value(), "alert('XSS')");
$item_metadata->set_value($this->link);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), 'link');
$item_metadata->set_value($this->css);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), 'my text along with some style a { display: none }');
$item_metadata->set_value($this->iframe);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), '');
$item_metadata->set_value($this->strong);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), $this->strong);
$item_metadata->set_value($this->html);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), $this->html);
}
}

View File

@ -2,29 +2,52 @@
namespace Tainacan\Tests;
use Tainacan\Entities\Item_Metadata_Entity;
/**
* Class TestCollections
* Class Item_Metadata
*
* @package Test_Tainacan
*/
/**
* Sample test case.
* Item_Metadata test case.
*/
class Item_Metadata extends TAINACAN_UnitTestCase {
private $collection = null;
private $item = null;
private $separator = '<span class="multivalue-separator"> | </span>';
public function setUp() {
parent::setUp();
$c = $this->tainacan_entity_factory->create_entity('collection', ['name' => 'My Collection'], true);
$i = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'My test item',
'description' => 'item description',
'collection' => $c,
'status' => 'publish'
),
true
);
$this->collection = $c;
$this->item = $i;
}
/**
* Teste da insercao de um metadado simples sem o tipo
*/
function test_add() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'teste',
'name' => 'test',
'description' => 'No description',
),
true
@ -46,8 +69,8 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$i = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'item teste',
'description' => 'adasdasdsa',
'title' => 'item teste title',
'description' => 'item description',
'collection' => $collection
),
true
@ -57,7 +80,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$item = $Tainacan_Items->fetch($i->get_id());
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($item, $test);
$item_metadata = new Item_Metadata_Entity($item, $test);
$item_metadata->set_value('teste_value');
$item_metadata->validate();
@ -70,7 +93,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
/**
* Teste da insercao de um metadado simples com o tipo
*/
function teste_required(){
function test_required(){
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
@ -111,7 +134,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$item = $Tainacan_Items->fetch($i->get_id());
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($item, $test);
$item_metadata = new Item_Metadata_Entity($item, $test);
// false because its required
$this->assertFalse($item_metadata->validate());
@ -125,7 +148,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$this->assertEquals('teste_value', $item_metadata->get_value());
}
function teste_collection_key(){
function test_collection_key(){
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
@ -176,7 +199,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$value = 'teste_val';
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
$item_metadata = new Item_Metadata_Entity($i, $metadatum);
$item_metadata->set_value($value);
$this->assertTrue($item_metadata->validate());
@ -184,16 +207,16 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
$n_item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
$n_item_metadata = new Item_Metadata_Entity($i, $metadatum);
$n_item_metadata->set_value($value);
$this->assertTrue($n_item_metadata->validate(), 'trying to validate the same item with same value should be ok');
$n_item_metadata2 = new \Tainacan\Entities\Item_Metadata_Entity($i2, $metadatum);
$n_item_metadata2 = new Item_Metadata_Entity($i2, $metadatum);
$n_item_metadata2->set_value($value);
$this->assertFalse($n_item_metadata2->validate(), 'Collection key should not validate another item metadatada with the same value');
}
function teste_fetch(){
function test_fetch(){
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
@ -247,8 +270,6 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
}
function test_metadata_text_textarea() {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
@ -291,11 +312,11 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
);
$value_text = 'GOOGLE: www.google.com';
$item_metadata_text = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_text);
$item_metadata_text = new Item_Metadata_Entity($i, $metadatum_text);
$item_metadata_text->set_value($value_text);
$value_textarea = 'GOOGLE: www.google.com \n GOOGLE: https://www.google.com';
$item_metadata_textarea = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_textarea);
$item_metadata_textarea = new Item_Metadata_Entity($i, $metadatum_textarea);
$item_metadata_textarea->set_value($value_textarea);
$response_text = 'GOOGLE: <a href="http://www.google.com" target="_blank" title="www.google.com">www.google.com</a>';
@ -303,12 +324,22 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$this->assertEquals($item_metadata_text->get_value_as_html(), $response_text);
$this->assertEquals($item_metadata_textarea->get_value_as_html(), $response_textarea);
// Poor HTML entry tests
$badFormatted_HTML = "<p> I started my content <div> and make something else here </div> without closing its HTML properly";
$item_metadata_text->set_value($badFormatted_HTML);
$item_metadata_textarea->set_value($badFormatted_HTML);
$this->assertEquals($item_metadata_text->get_value_as_html(), $badFormatted_HTML ."</p>");
$this->assertEquals($item_metadata_textarea->get_value_as_html(), $badFormatted_HTML ."</p>");
}
/**
* @group test_item_metadata_has_value
*/
function test_item_metadata_has_value() {
$test_value = 'has_value';
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$collection = $this->tainacan_entity_factory->create_entity(
@ -343,7 +374,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
);
$value_textarea = '';
$item_metadata_textarea = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_textarea);
$item_metadata_textarea = new Item_Metadata_Entity($i, $metadatum_textarea);
$item_metadata_textarea->set_value($value_textarea);
$item_metadata_textarea->validate();
@ -351,7 +382,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$this->assertFalse($item_metadata_textarea->has_value());
$item_metadata_textarea->set_value('has_value');
$item_metadata_textarea->set_value($test_value);
$item_metadata_textarea->validate();
$item_metadata_textarea = $Tainacan_Item_Metadata->insert($item_metadata_textarea);
@ -369,24 +400,366 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
true
);
$item_metadata_text = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum_text);
$item_metadata_text = new Item_Metadata_Entity($i, $metadatum_text);
$item_metadata_text->set_value([
''
]);
$item_metadata_text->set_value([ $value_textarea ]);
$item_metadata_text->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata_text);
$this->assertFalse($item_metadata->has_value());
$item_metadata_text->set_value([
'has_value'
]);
$item_metadata_text->set_value([ $test_value ]);
$item_metadata_text->validate();
$item_metadata_text = $Tainacan_Item_Metadata->insert($item_metadata_text);
$this->assertTrue($item_metadata_text->has_value());
}
function test_numeric_metadata_html() {
// Simple numeric metadata
$metadatum_numeric = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'Numeric important meta',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\Numeric',
'status' => 'publish'
),
true
);
// Multiple numeric metadata
$metadatum_numeric_multiple = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'Numeric important meta',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\Numeric',
'status' => 'publish',
'multiple' => 'yes'
),
true
);
$item_metadata_numeric = new Item_Metadata_Entity($this->item, $metadatum_numeric);
$item_metadata_numeric->set_value(10);
$item_metadata_numeric->validate();
$this->assertEquals($item_metadata_numeric->get_value_as_html(), 10);
$item_metadata_numeric_mult = new Item_Metadata_Entity($this->item, $metadatum_numeric_multiple);
$item_metadata_numeric_mult->set_value([10,22,4]);
$item_metadata_numeric_mult->validate();
$this->assertEquals($item_metadata_numeric_mult->get_value_as_html(), "10" . $this->separator . "22" . $this->separator . "4");
}
function test_date_metadata_html() {
// Simple date metadata
$metadatum_date = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'Date important meta',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\Date',
'status' => 'publish'
),
true
);
// Multiple date metadata
$metadatum_date_multiple = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'Date meta',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\Date',
'status' => 'publish',
'multiple' => 'yes'
),
true
);
$item_metadata_date = new Item_Metadata_Entity($this->item, $metadatum_date);
// Invalid date value
$item_metadata_date->set_value(10);
$item_metadata_date->validate();
$this->assertFalse($item_metadata_date->get_value_as_html());
$item_metadata_date->set_value("2021-04-05");
$item_metadata_date->validate();
$this->assertEquals($item_metadata_date->get_value_as_html(), "April 5, 2021");
$item_metadata_date_mult = new Item_Metadata_Entity($this->item, $metadatum_date_multiple);
// Invalid date values
$item_metadata_date_mult->set_value([10,22,4]);
$item_metadata_date_mult->validate();
$this->assertEquals($item_metadata_date_mult->get_value_as_html(), $this->separator . $this->separator );
$item_metadata_date_mult->set_value(["2021-04-05", "2021-12-30"]);
$item_metadata_date_mult->validate();
$this->assertEquals($item_metadata_date_mult->get_value_as_html(), 'April 5, 2021' . $this->separator . 'December 30, 2021');
}
function test_user_metadata_html() {
$user_metadata = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'User metadata',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\User',
'status' => 'publish'
),
true
);
$user_meta = new Item_Metadata_Entity($this->item, $user_metadata);
// Empty val
$this->assertEmpty($user_meta->get_value_as_html());
$new_user = $this->factory()->user->create(array( 'role' => 'subscriber', 'display_name' => 'User Name' ));
$user_meta->set_value($new_user);
$user_meta->validate();
$this->assertEquals($user_meta->get_value_as_html(), "User Name");
$user_metadata_multiple = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'User metadata',
'description' => 'and its description',
'collection_id' => $this->collection->get_id(),
'metadata_type' => 'Tainacan\Metadata_Types\User',
'status' => 'publish',
'multiple' => 'yes'
),
true
);
$user_meta_multi = new Item_Metadata_Entity($this->item, $user_metadata_multiple);
$this->assertEmpty($user_meta_multi->get_value_as_html());
$sec_user = $this->factory()->user->create(array( 'role' => 'subscriber', 'display_name' => 'User Name 2' ));
$user_meta_multi->set_value([$new_user, $sec_user]);
$user_meta_multi->validate();
$this->assertEquals($user_meta_multi->get_value_as_html(), 'User Name' . $this->separator . 'User Name 2');
}
function test_selectbox_metadata_html() {
$selectbox_metadata = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My selectbox meta',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Selectbox',
'metadata_type_options' => [
'options' => ['tainacan', 'wordpress', 'php']
]
),
true
);
$selectbox_metadata_multiple = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My selectbox meta',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Selectbox',
'multiple' => 'yes',
'metadata_type_options' => [
'options' => ['tainacan', 'wordpress', 'php']
]
),
true
);
$sb_meta = new Item_Metadata_Entity($this->item, $selectbox_metadata);
$sb_meta->set_value('tainacan');
$sb_meta->validate();
$this->assertEquals($sb_meta->get_value_as_html(), 'tainacan');
$sb_meta->set_value('php');
$this->assertEquals($sb_meta->get_value_as_html(), 'php');
$sb_meta_multi = new Item_Metadata_Entity($this->item, $selectbox_metadata_multiple);
$sb_meta_multi->set_value(['tainacan', 'wordpress']);
$sb_meta_multi->validate();
$this->assertEquals($sb_meta_multi->get_value_as_html(), 'tainacan' . $this->separator . 'wordpress');
}
function test_relationship_metadata_html() {
$referenced_collection = $this->tainacan_entity_factory->create_entity(
'collection',
['name' => 'INXS Songs'],
true
);
$mystify = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'Mystify',
'description' => '"Mystify" is the 9th track of INXS 6th album "Kick".',
'collection' => $referenced_collection,
'status' => 'publish'
),
true
);
$disappear = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'Disappear',
'description' => '"Disappear" is the second single from INXS 7th album "X".It was released in December 1990.',
'collection' => $referenced_collection,
'status' => 'publish'
),
true
);
$expected_return = $this->relationship_expected_return($mystify->get_id(), $mystify->get_title());
$expected_return2 = $this->relationship_expected_return($disappear->get_id(), $disappear->get_title());
$relationship_metadata = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'Relationship meta',
'description' => 'My desc',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Relationship',
'status' => 'publish',
'metadata_type_options' => [
'collection_id' => $referenced_collection->get_id(),
'search' => $referenced_collection->get_core_title_metadatum()->get_id()
]
),
true
);
$item_metadata_relationship = new Item_Metadata_Entity($this->item, $relationship_metadata);
$item_metadata_relationship->validate();
$this->assertEquals($item_metadata_relationship->get_value_as_html(), '');
$item_metadata_relationship->set_value($mystify->get_id());
$item_metadata_relationship->validate();
$this->assertEquals($item_metadata_relationship->get_value_as_html(), $expected_return);
$item_metadata_relationship->set_value([$this->collection->get_id()]);
$item_metadata_relationship->validate();
$this->assertEquals($item_metadata_relationship->get_value_as_html(), '');
$relationship_metadata->set_multiple('yes');
$item_metadata_relationship->set_value([ $mystify->get_id(), $disappear->get_id() ]);
$this->assertEquals($item_metadata_relationship->get_value_as_html(), "${expected_return}" . $this->separator . "${expected_return2}");
}
function test_taxonomy_metadata_html() {
$taxonomy = $this->tainacan_entity_factory->create_entity(
'taxonomy',
array(
'name' => 'My Taxonomy test',
'collections' => [$this->collection],
'status' => 'publish'
),
true
);
$term = $this->tainacan_entity_factory->create_entity(
'term',
array(
'taxonomy' => $taxonomy->get_db_identifier(),
'name' => 'first term from my tax',
),
true
);
$term2 = $this->tainacan_entity_factory->create_entity(
'term',
array(
'taxonomy' => $taxonomy->get_db_identifier(),
'name' => 'Second term from my tax',
),
true
);
$taxonomy_meta = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My tax meta',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Taxonomy',
'metadata_type_options' => [
'taxonomy_id' => $taxonomy->get_id(),
]
),
true
);
$item_taxonomy_metadata = new Item_Metadata_Entity($this->item, $taxonomy_meta);
$item_taxonomy_metadata->set_value('');
$item_taxonomy_metadata->validate();
$this->assertEmpty($item_taxonomy_metadata->get_value_as_html());
$item_taxonomy_metadata->set_value($term);
$item_taxonomy_metadata->validate();
$term_id = $term->get_id();
$link = get_term_link( (int) $term_id );
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='{$link}'>first term from my tax</a>");
$taxonomy_meta->set_multiple('yes');
$item_taxonomy_metadata->set_value([ $term, $term2 ]);
$item_taxonomy_metadata->validate();
$term_id = $term->get_id();
$term_id2 = $term2->get_id();
$link = get_term_link( (int) $term_id );
$link2 = get_term_link( (int) $term_id2 );
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='{$link}'>first term from my tax</a><span class=\"multivalue-separator\"> | </span><a data-linkto='term' data-id='{$term_id2}' href='{$link2}'>Second term from my tax</a>");
}
function test_compound_metadata_html() {
$compound_meta = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My compound Meta',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Compound',
),
true
);
$text_meta = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My Text meta',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Text',
'parent' => $compound_meta->get_id()
),
true
);
$textarea_meta = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My Textarea meta!',
'status' => 'publish',
'collection' => $this->collection,
'metadata_type' => 'Tainacan\Metadata_Types\Textarea',
'parent' => $compound_meta->get_id()
),
true
);
$item_compound_metadata = new Item_Metadata_Entity($this->item, $compound_meta);
$item_compound_metadata->set_value(['invalid meta value!']);
$this->assertEquals($item_compound_metadata->get_value_as_html(), "<div class='tainacan-compound-group'> </div>");
}
private function relationship_expected_return($id, $title) {
$URL = get_permalink($id);
return "<a data-linkto='item' data-id='${id}' href='${URL}'>${title}</a>";
}
}

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