From e07d0a3b29775d1cfb3da4ff50c315e0ac4cd1a8 Mon Sep 17 00:00:00 2001
From: Adrian
Date: Thu, 11 Nov 2021 00:48:10 +0200
Subject: [PATCH] more minor spelling fixes
---
...lass-tainacan-rest-bulkedit-controller.php | 4 +-
...s-tainacan-rest-collections-controller.php | 6 +-
.../class-tainacan-rest-items-controller.php | 4 +-
...lass-tainacan-rest-metadata-controller.php | 2 +-
...acan-rest-metadatum-mappers-controller.php | 2 +-
...tainacan-rest-sequence-edit-controller.php | 2 +-
...ss-tainacan-rest-taxonomies-controller.php | 2 +-
.../class-tainacan-rest-terms-controller.php | 4 +-
src/classes/class-tainacan-bulk-edit.php | 4 +-
.../entities/class-tainacan-filter.php | 2 +-
.../entities/class-tainacan-metadatum.php | 4 +-
src/classes/entities/class-tainacan-term.php | 2 +-
.../exporter/class-tainacan-term-exporter.php | 6 +-
.../class-tainacan-bulk-edit-process.php | 2 +-
src/classes/importer/class-tainacan-csv.php | 10 +-
.../class-tainacan-oaipmh-importer.php | 6 +-
.../importer/class-tainacan-old-tainacan.php | 166 +++++------
.../repositories/class-tainacan-filters.php | 4 +-
.../class-tainacan-item-metadata.php | 2 +-
.../repositories/class-tainacan-items.php | 2 +-
.../repositories/class-tainacan-logs.php | 264 +++++++++---------
.../repositories/class-tainacan-metadata.php | 6 +-
.../class-tainacan-theme-helper.php | 2 +-
src/classes/theme-helper/template-tags.php | 2 +-
.../admin/components/lists/processes-list.vue | 4 +-
.../class-tainacan-core-description.php | 2 +-
.../core-title/class-tainacan-core-title.php | 2 +-
.../class-tainacan-metadata-type.php | 2 +-
.../components/other/processes-popup.vue | 2 +-
.../scss/_dropdown-and-autocomplete.scss | 46 +--
.../blocks/item-submission-form/edit.js | 112 ++++----
src/views/tainacan-i18n.php | 8 +-
tests/test-core-metadatum-types.php | 4 +-
33 files changed, 346 insertions(+), 346 deletions(-)
diff --git a/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php b/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php
index 7acf02384..963e68c68 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php
@@ -265,7 +265,7 @@ class REST_Bulkedit_Controller extends REST_Controller {
];
} else {
return new \WP_REST_Response([
- 'error_message' => __('You mus specify items_ids OR use_query', 'tainacan'),
+ 'error_message' => __('You must specify items_ids OR use_query', 'tainacan'),
], 400);
}
@@ -352,7 +352,7 @@ class REST_Bulkedit_Controller extends REST_Controller {
if ( !in_array($method, ['trash_items', 'untrash_items', 'delete_items']) ) {
if (empty($body)) {
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-collections-controller.php b/src/classes/api/endpoints/class-tainacan-rest-collections-controller.php
index 0b0cbe036..6b06d8328 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-collections-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-collections-controller.php
@@ -87,7 +87,7 @@ class REST_Collections_Controller extends REST_Controller {
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
'args' => [
'metadata_order' => [
- 'description' => __( 'The order of the metadata in the collection, an array of objects with integer id and bool enabled.', 'tainacan' ),
+ 'description' => __( 'The order of the metadata in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'required' => true,
'validate_callback' => [$this, 'validate_filters_metadata_order']
]
@@ -102,7 +102,7 @@ class REST_Collections_Controller extends REST_Controller {
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
'args' => [
'filters_order' => [
- 'description' => __( 'The order of the filters in the collection, an array of objects with integer id and bool enabled.', 'tainacan' ),
+ 'description' => __( 'The order of the filters in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'required' => true,
'validate_callback' => [$this, 'validate_filters_metadata_order']
]
@@ -353,7 +353,7 @@ class REST_Collections_Controller extends REST_Controller {
if(empty($body)){
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'collection' => $body
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php
index 1fb8abe6a..8d8e1ece5 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php
@@ -637,7 +637,7 @@ class REST_Items_Controller extends REST_Controller {
if(empty($item)){
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'item' => $item
], 400);
}
@@ -964,7 +964,7 @@ class REST_Items_Controller extends REST_Controller {
if(empty($item) || empty($metadata)) {
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'item' => $item
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-metadata-controller.php b/src/classes/api/endpoints/class-tainacan-rest-metadata-controller.php
index c578021a0..7aeb18f4f 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-metadata-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-metadata-controller.php
@@ -266,7 +266,7 @@ class REST_Metadata_Controller extends REST_Controller {
}
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'item' => $request->get_body()
], 400);
diff --git a/src/classes/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php b/src/classes/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php
index 206df004f..f7685d3e0 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php
@@ -167,7 +167,7 @@ class REST_Metadatum_Mappers_Controller extends REST_Controller {
}
}
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'item' => $request->get_body()
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-sequence-edit-controller.php b/src/classes/api/endpoints/class-tainacan-rest-sequence-edit-controller.php
index bcea3ecaa..5a2fc1c6d 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-sequence-edit-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-sequence-edit-controller.php
@@ -104,7 +104,7 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
} else {
return new \WP_REST_Response([
- 'error_message' => __('You mus specify items_ids OR use_query', 'tainacan'),
+ 'error_message' => __('You must specify items_ids OR use_query', 'tainacan'),
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-taxonomies-controller.php b/src/classes/api/endpoints/class-tainacan-rest-taxonomies-controller.php
index b6d0189fe..ab77d9d21 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-taxonomies-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-taxonomies-controller.php
@@ -390,7 +390,7 @@ class REST_Taxonomies_Controller extends REST_Controller {
}
} else {
return new \WP_REST_Response([
- 'error_message' => __('Body can not be empty.', 'tainacan'),
+ 'error_message' => __('Body cannot be empty.', 'tainacan'),
'body' => $body
], 400);
}
diff --git a/src/classes/api/endpoints/class-tainacan-rest-terms-controller.php b/src/classes/api/endpoints/class-tainacan-rest-terms-controller.php
index 0fe7a3788..8f13b7ba8 100644
--- a/src/classes/api/endpoints/class-tainacan-rest-terms-controller.php
+++ b/src/classes/api/endpoints/class-tainacan-rest-terms-controller.php
@@ -450,12 +450,12 @@ class REST_Terms_Controller extends REST_Controller {
$endpoint_args['metadatum_id'] = [
'required' => false,
'type' => 'integer',
- 'description' => __('If term is being created in the context of a Taxonomy metadatum, inform its ID')
+ 'description' => __('If term is being created in the context of a Taxonomy metadatum, specify its ID')
];
$endpoint_args['item_id'] = [
'required' => false,
'type' => 'integer',
- 'description' => __('If term is being created in the context of a Taxonomy metadatum, inform the ID of the item being edited')
+ 'description' => __('If term is being created in the context of a Taxonomy metadatum, specify the ID of the item being edited')
];
}
diff --git a/src/classes/class-tainacan-bulk-edit.php b/src/classes/class-tainacan-bulk-edit.php
index 16363b83c..93cd76ef0 100644
--- a/src/classes/class-tainacan-bulk-edit.php
+++ b/src/classes/class-tainacan-bulk-edit.php
@@ -362,7 +362,7 @@ class __Bulk_Edit {
}
if ($new_value == $old_value) {
- return new \WP_Error( 'invalid_action', __( 'Old value and new value can not be the same', 'tainacan' ) );
+ return new \WP_Error( 'invalid_action', __( 'Old value and new value cannot be the same', 'tainacan' ) );
}
$dummyItem = new Entities\Item();
@@ -611,7 +611,7 @@ class __Bulk_Edit {
global $wpdb;
if ($value == $newvalue) {
- return new \WP_Error( 'error', __( 'New value and old value can not be the same', 'tainacan' ) );
+ return new \WP_Error( 'error', __( 'New value and old value cannot be the same', 'tainacan' ) );
}
$taxRepo = Repositories\Taxonomies::get_instance();
diff --git a/src/classes/entities/class-tainacan-filter.php b/src/classes/entities/class-tainacan-filter.php
index f1e84e2d1..087487bd3 100644
--- a/src/classes/entities/class-tainacan-filter.php
+++ b/src/classes/entities/class-tainacan-filter.php
@@ -288,7 +288,7 @@ class Filter extends Entity {
if ($metadatum) {
$metadatum_status_obj = get_post_status_object($metadatum->get_status());
if ( ! $metadatum_status_obj->public ) {
- $this->add_error('status', __('Filter can not be public because the related metadatum is private', 'tainacan'));
+ $this->add_error('status', __('Filter cannot be public because the related metadatum is private', 'tainacan'));
return false;
}
}
diff --git a/src/classes/entities/class-tainacan-metadatum.php b/src/classes/entities/class-tainacan-metadatum.php
index a0e99ff14..36d4ce01a 100644
--- a/src/classes/entities/class-tainacan-metadatum.php
+++ b/src/classes/entities/class-tainacan-metadatum.php
@@ -462,7 +462,7 @@ class Metadatum extends Entity {
if ( $this->get_parent() > 0 && $this->get_metadata_type_object()->get_primitive_type() == 'term' ) {
$parent_metadatum = new \Tainacan\Entities\Metadatum($this->get_parent());
if ( $parent_metadatum->is_multiple() ) {
- $this->add_error($this->get_id(), __('Taxonomy metadata can not be used inside Compound metadata with multiple values', 'tainacan'));
+ $this->add_error($this->get_id(), __('Taxonomy metadata cannot be used inside Compound metadata with multiple values', 'tainacan'));
return false;
}
}
@@ -478,7 +478,7 @@ class Metadatum extends Entity {
, 'OBJECT');
if ( sizeof($children_taxonomy) > 0 ) {
- $this->add_error($this->get_id(), __('Taxonomy metadata can not be used inside Compound metadata with multiple values', 'tainacan'));
+ $this->add_error($this->get_id(), __('Taxonomy metadata cannot be used inside Compound metadata with multiple values', 'tainacan'));
return false;
}
diff --git a/src/classes/entities/class-tainacan-term.php b/src/classes/entities/class-tainacan-term.php
index 0488f1c31..c2cc80392 100644
--- a/src/classes/entities/class-tainacan-term.php
+++ b/src/classes/entities/class-tainacan-term.php
@@ -237,7 +237,7 @@ class Term extends Entity {
if (false !== $term_exists) {
if ($this->get_id() != $term_exists->term_id) {
- $this->add_error( 'name', __('You can not have two terms with the same name at the same level', 'tainacan') );
+ $this->add_error( 'name', __('You cannot have two terms with the same name at the same level', 'tainacan') );
return false;
}
}
diff --git a/src/classes/exporter/class-tainacan-term-exporter.php b/src/classes/exporter/class-tainacan-term-exporter.php
index d79cd733c..7fe612680 100644
--- a/src/classes/exporter/class-tainacan-term-exporter.php
+++ b/src/classes/exporter/class-tainacan-term-exporter.php
@@ -115,7 +115,7 @@ class Term_Exporter extends Exporter {
@@ -148,7 +148,7 @@ class Term_Exporter extends Exporter {
}
/**
- *
+ *
*/
public function exporting_terms(){
@@ -195,4 +195,4 @@ class Term_Exporter extends Exporter {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php
index a6bbcba2a..6836d28b8 100644
--- a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php
+++ b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php
@@ -435,7 +435,7 @@ class Bulk_Edit_Process extends Generic_Process {
}
if ($new_value == $old_value) {
- $this->add_error_log( __( 'Old value and new value can not be the same', 'tainacan' ) );
+ $this->add_error_log( __( 'Old value and new value cannot be the same', 'tainacan' ) );
return false;
}
diff --git a/src/classes/importer/class-tainacan-csv.php b/src/classes/importer/class-tainacan-csv.php
index 2a39bf8df..64211ed5f 100644
--- a/src/classes/importer/class-tainacan-csv.php
+++ b/src/classes/importer/class-tainacan-csv.php
@@ -45,7 +45,7 @@ class CSV extends Importer {
$this->set_option('document_import_mode', 'replace');
$this->set_option('document_index', $index);
} else if( $rawColumn === 'special_attachments' ||
- $rawColumn === 'special_attachments|APPEND' ||
+ $rawColumn === 'special_attachments|APPEND' ||
$rawColumn === 'special_attachments|REPLACE' ) {
$this->set_option('attachment_index', $index);
$attachment_type = explode('|', $rawColumn);
@@ -127,7 +127,7 @@ class CSV extends Importer {
return $header;
}
return $header;
- }, $this->raw_source_metadata());
+ }, $this->raw_source_metadata());
$item_line = (int) $index + 2;
@@ -199,7 +199,7 @@ class CSV extends Importer {
$returnValue = [];
foreach($valueToInsert as $index => $metadatumValue) {
$childrenHeaders = str_getcsv($compoundHeaders[$key], $this->get_option('delimiter'), $this->get_option('enclosure'));
- $childrenValue = $this->is_clear_value($metadatumValue) ?
+ $childrenValue = $this->is_clear_value($metadatumValue) ?
array_fill(0, sizeof($childrenHeaders), $this->get_option('escape_empty_value') ) :
str_getcsv($metadatumValue, $this->get_option('delimiter'), $this->get_option('enclosure'));
@@ -414,7 +414,7 @@ class CSV extends Importer {
-
+
@@ -462,7 +462,7 @@ class CSV extends Importer {
diff --git a/src/classes/importer/class-tainacan-oaipmh-importer.php b/src/classes/importer/class-tainacan-oaipmh-importer.php
index f0a61eee8..2da3f3108 100644
--- a/src/classes/importer/class-tainacan-oaipmh-importer.php
+++ b/src/classes/importer/class-tainacan-oaipmh-importer.php
@@ -179,7 +179,7 @@ class Oaipmh_Importer extends Importer {
$metadata_map = $this->create_collection_metadata($collection);
$total = intval($this->get_total_items_from_source($setSpec));
$this->add_log('total in collection: ' . $total);
- $this->add_log('collection id ' . (string) $collection->get_id());
+ $this->add_log('collection ID ' . (string) $collection->get_id());
$this->add_collection([
'id' => $collection->get_id(),
@@ -194,7 +194,7 @@ class Oaipmh_Importer extends Importer {
$metadata_map = $this->create_collection_metadata($collection);
$total = intval( $this->get_total_items_from_source(false) );
$this->add_log('total in collection: ' . $total);
- $this->add_log('collection id ' . (string) $collection->get_id());
+ $this->add_log('collection ID ' . (string) $collection->get_id());
$tax = new Entities\Taxonomy();
$tax->set_name( $this->NAME_FOR_SETS );
@@ -869,4 +869,4 @@ class Oaipmh_Importer extends Importer {
return ob_get_clean();
}
-}
\ No newline at end of file
+}
diff --git a/src/classes/importer/class-tainacan-old-tainacan.php b/src/classes/importer/class-tainacan-old-tainacan.php
index 70044e5ef..ee9e56ee4 100644
--- a/src/classes/importer/class-tainacan-old-tainacan.php
+++ b/src/classes/importer/class-tainacan-old-tainacan.php
@@ -33,7 +33,7 @@ class Old_Tainacan extends Importer{
'total' => 5
]
];
-
+
protected $tainacan_api_address, $wordpress_api_address, $actual_collection;
/**
@@ -48,7 +48,7 @@ class Old_Tainacan extends Importer{
$this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance();
$this->term_repo = \Tainacan\Repositories\Terms::get_instance();
$this->item_metadata_repo = \Tainacan\Repositories\Item_Metadata::get_instance();
-
+
$this->remove_import_method('file');
$this->add_import_method('url');
$this->tainacan_api_address = "/wp-json/tainacan/v1";
@@ -59,7 +59,7 @@ class Old_Tainacan extends Importer{
/**
* create taxonomies ( taxonomies in tainacan old in first level )
* next create the terms
- *
+ *
*/
public function create_taxonomies() {
if (!$this->get_url()) {
@@ -67,20 +67,20 @@ class Old_Tainacan extends Importer{
$this->abort();
return false;
}
-
+
$this->add_log('Creating taxonomies');
-
+
foreach ($this->get_taxonomies() as $taxonomy) {
$tax = new Entities\Taxonomy();
$tax->set_name( $taxonomy->name );
$tax->set_description( $taxonomy->description );
$tax->set_allow_insert('yes');
- $tax->set_status('publish');
+ $tax->set_status('publish');
if ($tax->validate()) {
$tax = $this->tax_repo->insert($tax);
-
- $this->add_log('Taxonomy ' . $tax->get_name() . ' created, id from Old'. $taxonomy->term_id );
+
+ $this->add_log('Taxonomy ' . $tax->get_name() . ' created, ID from Old'. $taxonomy->term_id );
$this->add_transient('tax_' . $taxonomy->term_id . '_id', $tax->get_id());
$this->add_transient('tax_' . $taxonomy->term_id . '_name', $tax->get_name());
@@ -95,14 +95,14 @@ class Old_Tainacan extends Importer{
return false;
}
-
+
/**
* create the repository metadata which each collection inherits by default
- *
+ *
*/
public function create_repo_metadata() {
$this->add_log('Creating repository metadata');
-
+
foreach ($this->get_repo_metadata() as $metadata) {
if (isset($metadata->slug) && strpos($metadata->slug, 'socialdb_property_fixed') === false) {
$metadatum_id = $this->create_metadata( $metadata );
@@ -117,12 +117,12 @@ class Old_Tainacan extends Importer{
/**
* create all collections and its metadata
- *
+ *
*/
public function create_collections(){
$this->add_log('Creating collections');
-
+
foreach ($this->fetch_collections() as $collection) {
$map = [];
$this->add_log(memory_get_usage());
@@ -136,16 +136,16 @@ class Old_Tainacan extends Importer{
$metadatum_id = $this->create_metadata( $metadatum_old, $collection_id );
if( $metadatum_id ){
- $map[$metadatum_id] = $metadatum_old->id;
+ $map[$metadatum_id] = $metadatum_old->id;
}
-
+
} else if( isset($metadatum_old->slug) && strpos($metadatum_old->slug, 'socialdb_property_fixed_tags') !== false
&& isset($metadatum_old->type) && strpos($metadatum_old->type, 'checkbox') !== false
){
$metadatum_id = $this->create_metadata( $metadatum_old, $collection_id );
$this->add_log('Creating tag');
if( $metadatum_id ){
- $map[$metadatum_id] = $metadatum_old->id;
+ $map[$metadatum_id] = $metadatum_old->id;
}
}
@@ -177,17 +177,17 @@ class Old_Tainacan extends Importer{
if( $collections && is_array( $collections ) ){
foreach( $collections as $collection ){ // loop collections
- $map = $this->get_transient('collection_' . $collection->get_id() . '_relationships');
-
+ $map = $this->get_transient('collection_' . $collection->get_id() . '_relationships');
+
if(!$map){
return false;
}
- foreach( $map as $metadatum_id => $items ){ // all relations in collection
+ foreach( $map as $metadatum_id => $items ){ // all relations in collection
$newMetadatum = new Entities\Metadatum($metadatum_id);
- $first_index_id = key($items);
- $collection_id = $this->get_transient('item_' . $items[$first_index_id] . '_collection');
+ $first_index_id = key($items);
+ $collection_id = $this->get_transient('item_' . $items[$first_index_id] . '_collection');
$newMetadatum->set_metadata_type_options(['collection_id' => $collection_id ]);
@@ -198,7 +198,7 @@ class Old_Tainacan extends Importer{
reset($items);
foreach( $items as $item_id => $value_old ){ // all values
- $value_new = $this->get_transient('item_' . $value_old . '_id');
+ $value_new = $this->get_transient('item_' . $value_old . '_id');
$item = new Entities\Item($item_id);
$item_metadata = new Entities\Item_Metadata_Entity( $item, $newMetadatum );
@@ -226,15 +226,15 @@ class Old_Tainacan extends Importer{
'redirection' => 30,
);
- $page = intval( $index ) + 1;
+ $page = intval( $index ) + 1;
$this->add_log('Proccess item index' . $index . ' in collection OLD ' . $collection_id['source_id'] );
- $url_to_fetch = $this->get_url() . $this->tainacan_api_address . "/collections/".
+ $url_to_fetch = $this->get_url() . $this->tainacan_api_address . "/collections/".
$collection_id['source_id']."/items?includeMetadata=1&filter[items_per_page]=1&filter[page]=" . $page
. "&filter[order_by]=ID&filter[order]=ASC";
- $info = $this->requester( $url_to_fetch, $args );
+ $info = $this->requester( $url_to_fetch, $args );
$info = json_decode($info['body']);
if( !isset( $info->items ) ){
@@ -248,7 +248,7 @@ class Old_Tainacan extends Importer{
$this->abort();
return false;
}
-
+
$the_item = null;
foreach( $info->items as $item ){
@@ -257,7 +257,7 @@ class Old_Tainacan extends Importer{
if( isset($the_item) && isset($the_item->item) && !empty($the_item->item) ){
$item_Old = $the_item;
- $this->add_log('item found ', $the_item->item->ID );
+ $this->add_log('item found ', $the_item->item->ID );
return [ 'item' => $item_Old, 'collection_definition' => $collection_id ];
} else {
$this->add_error_log('fetching remote ' . $url_to_fetch);
@@ -273,7 +273,7 @@ class Old_Tainacan extends Importer{
* @param array $processed_item Associative array with metadatum source's as index with
* its value or values
* @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
- *
+ *
* @return Tainacan\Entities\Item Item inserted
*/
public function insert( $processed_item, $collection_index ) {
@@ -336,7 +336,7 @@ class Old_Tainacan extends Importer{
$newMetadatum = new Entities\Metadatum($new_tainacanid);
$item_metadata = new Entities\Item_Metadata_Entity( $item, $newMetadatum );
-
+
// avoid blank metadatum
if( isset($metadatum->empty) ){
@@ -357,7 +357,7 @@ class Old_Tainacan extends Importer{
if( in_array($metadatum->type,['text', 'textarea', 'numeric', 'date']) ){
if($metadatum->type === 'date'){
-
+
if(is_array($value)){
$values = [];
@@ -365,17 +365,17 @@ class Old_Tainacan extends Importer{
$v = explode('/',$day);
$v[1]= ( $v[1] < 10 ) ? '0'.$v[1] : $v[1];
- $v[0]= ( $v[0] < 10 ) ? '0'.$v[0] : $v[0];
+ $v[0]= ( $v[0] < 10 ) ? '0'.$v[0] : $v[0];
$values[] = $v[2] . '-' . $v[1] . '-' . $v[0];
- }
-
-
+ }
+
+
} else {
$v = explode('/',$value);
$v[1]= ( $v[1] < 10 ) ? '0'. $v[1] : $v[1];
- $v[0]= ( $v[0] < 10 ) ? '0'. $v[0] : $v[0];
+ $v[0]= ( $v[0] < 10 ) ? '0'. $v[0] : $v[0];
$values = $v[2] . '-' . $v[1] . '-' . $v[0];
}
@@ -386,12 +386,12 @@ class Old_Tainacan extends Importer{
$item_metadata->set_value($value);
} else if( $metadatum->type === 'item' ){ // RELATIONSHIPS
-
+
/**
* save the values to allow set the correct collection
* in metadata option in next step
*/
- $relationships[$new_tainacanid][$item->get_id()] = $value;
+ $relationships[$new_tainacanid][$item->get_id()] = $value;
} else {
@@ -403,7 +403,7 @@ class Old_Tainacan extends Importer{
if( $id )
$values[] = intval($id);
- }
+ }
} else {
$id = $this->get_transient('term_' . $value . '_id');
@@ -456,7 +456,7 @@ class Old_Tainacan extends Importer{
} else {
return 0;
}
-
+
}
/**
@@ -469,17 +469,17 @@ class Old_Tainacan extends Importer{
$args = array(
'timeout' => 30,
'redirection' => 30,
- );
+ );
+
+ $info = wp_remote_get( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items?includeMetadata=1&filter[page]=" . $page, $args );
- $info = wp_remote_get( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items?includeMetadata=1&filter[page]=" . $page, $args );
-
if( !isset($info['body']) ){
$this->add_error_log($result->get_error_message());
$this->add_error_log('Error in fetch remote first page item');
$this->abort();
return false;
}
-
+
$info = json_decode($info['body']);
while( isset($info->items) && count( $info->items ) > 0 ){
@@ -489,7 +489,7 @@ class Old_Tainacan extends Importer{
}
$page++;
- $info = wp_remote_get( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items?includeMetadata=1&filter[page]=" . $page, $args );
+ $info = wp_remote_get( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items?includeMetadata=1&filter[page]=" . $page, $args );
$info = json_decode($info['body']);
if( !isset($info['body']) ){
@@ -498,8 +498,8 @@ class Old_Tainacan extends Importer{
$this->abort();
return false;
}
- }
-
+ }
+
return $items;
}
@@ -593,7 +593,7 @@ class Old_Tainacan extends Importer{
}
/**
- * executes the request
+ * executes the request
*/
protected function requester( $link ){
$has_response = false;
@@ -609,13 +609,13 @@ class Old_Tainacan extends Importer{
$result = wp_remote_get($link, $args);
while( !$has_response ){
-
+
if (is_wp_error($result)) {
$this->add_log($result->get_error_message());
$this->add_log('Error in fetch remote' . $url);
$this->add_log('request number ' . $requests);
-
+
} else if (isset($result['body'])){
$this->add_log('fetch OK ');
return $result;
@@ -627,7 +627,7 @@ class Old_Tainacan extends Importer{
if( $requests > 3 ){
$this->add_log('taking a moment to breathe, waiting for ' . ( $requests * 10 ) . ' seconds ' );
- sleep( $requests * 10 );
+ sleep( $requests * 10 );
}
$args = array(
@@ -635,14 +635,14 @@ class Old_Tainacan extends Importer{
'redirection' => 30,
'sslverify' => false
);
-
+
$result = wp_remote_get($link, $args);
$requests++;
$this->add_log('going to ' . $requests );
}
-
+
$this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $url);
$this->abort();
@@ -653,7 +653,7 @@ class Old_Tainacan extends Importer{
* create recursively the terms from tainacan OLD
*
* @param Entities\Taxonomy $taxonomy_father
- * @param array $children Array of taxonomies from tainacan old
+ * @param array $children Array of taxonomies from tainacan old
* @param (optional) int $term_father the ID of father
*
* @return array
@@ -661,7 +661,7 @@ class Old_Tainacan extends Importer{
protected function add_all_terms($taxonomy_father, $children, $term_father = null){
$this->add_log('adding terms');
-
+
foreach ($children as $term) {
$new_term = new Entities\Term();
@@ -672,27 +672,27 @@ class Old_Tainacan extends Importer{
if($term_father){
$new_term->set_parent($term_father->get_id());
}
-
+
// block terms with same name and parent in taxonomy
if( get_term_by( 'name', $term->name, $taxonomy_father->get_db_identifier()) ){
continue;
}
-
+
if ($new_term->validate()) {
$inserted_term = $this->term_repo->insert($new_term);
} else {
$this->add_log( implode(',', $new_term->get_errors()) );
return false;
}
-
+
if (is_wp_error($inserted_term)) {
$this->add_log($inserted_term->get_error_message());
-
+
} else {
$this->add_log('Added term: ' . $inserted_term->get_name() . ' in tax: ' . $taxonomy_father->get_name());
- $this->add_log('Added term before id ' . $term->term_id );
+ $this->add_log('Added term before ID ' . $term->term_id );
}
/*Insert old tainacan id*/
@@ -709,8 +709,8 @@ class Old_Tainacan extends Importer{
/**
* create the a Metadatum in tainacan
- *
- * @return int $metadatum_id
+ *
+ * @return int $metadatum_id
*/
protected function create_metadata( $node_metadata_old, $collection_id = null){
$this->add_log('Creating metadata' . $meta->name);
@@ -751,7 +751,7 @@ class Old_Tainacan extends Importer{
return false;
}
} else if(strcmp($type, "Compound") === 0){
-
+
if( isset( $meta->metadata->children ) ){
foreach( $meta->metadata->children as $child ){
$this->create_metadata( $child, $collection_id);
@@ -778,9 +778,9 @@ class Old_Tainacan extends Importer{
if($newMetadatum->validate()){
$inserted_metadata = $this->metadata_repo->insert( $newMetadatum );
-
+
$this->add_log('Metadata created: ' . $inserted_metadata->get_name());
-
+
$this->add_transient('metadata_' . $inserted_metadata->get_id() . '_id', $inserted_metadata->get_id());
if(isset( $related_name) ){
@@ -788,48 +788,48 @@ class Old_Tainacan extends Importer{
}
return $inserted_metadata->get_id();
- } else{
+ } else{
$this->add_log('Error creating metadata ' . $name . ' in collection ' . $collection_id);
$this->add_log($newMetadatum->get_errors());
return false;
- }
+ }
}
/**
* create the collection in tainacan
- *
- * @return int $metadatum_id
+ *
+ * @return int $metadatum_id
*/
protected function create_collection( $node_collection ){
$new_collection = new Entities\Collection();
$new_collection->set_name($node_collection->post_title);
$new_collection->set_status('publish');
$new_collection->validate();
-
+
if($new_collection->validate()){
$new_collection =$this->col_repo->insert($new_collection);
-
+
$this->add_log('Collection created: ' . $new_collection->get_name());
if( $new_collection )
$this->add_transient('collection_' . $node_collection->ID . '_name', $new_collection->get_id());
return $new_collection->get_id();
- } else{
+ } else{
$this->add_error_log('Error creating collection ' . $node_collection->post_title );
$this->add_error_log($new_collection->get_errors());
$this->abort();
return false;
- }
+ }
}
-
+
/**
* Define the class to create in new Tainacan
- *
+ *
* @param string $type The type from tainacan old
- *
+ *
* @return string the class name
*/
private function define_type($type){
@@ -848,16 +848,16 @@ class Old_Tainacan extends Importer{
$type = "Compound";
} else {
$type = 'Text';
- }
+ }
return $type;
}
/**
* create attachments, document and thumb from old
- *
- * @param string $node_old
- *
+ *
+ * @param string $node_old
+ *
* @return string the class name
*/
private function insert_files( $node_old, $item ){
@@ -867,7 +867,7 @@ class Old_Tainacan extends Importer{
foreach( $types as $type){
if( isset( $node_old->attachments->$type ) ){
-
+
foreach( $node_old->attachments->$type as $attach){
$TainacanMedia->insert_attachment_from_url($attach->url, $item->get_id());
}
@@ -883,7 +883,7 @@ class Old_Tainacan extends Importer{
if( isset( $node_old->content_tainacan ) && $node_old->content_tainacan ){
$TainacanMedia = \Tainacan\Media::get_instance();
-
+
if( isset($node_old->content_tainacan->guid) ){
$id = $TainacanMedia->insert_attachment_from_url( $node_old->content_tainacan->guid, $item->get_id());
@@ -891,13 +891,13 @@ class Old_Tainacan extends Importer{
$item->set_document( $id );
$item->set_document_type( 'attachment' );
$this->add_log('Document imported from ' . $node_old->content_tainacan->guid);
- }
+ }
} else if( isset($node_old->type_tainacan) && in_array( $node_old->type_tainacan, ['audio','video','image']) ){
$item->set_document( $node_old->content_tainacan );
$item->set_document_type( 'url' );
$this->add_log('URL imported from ' . $node_old->content_tainacan);
}
-
+
}
if( $item->validate() )
diff --git a/src/classes/repositories/class-tainacan-filters.php b/src/classes/repositories/class-tainacan-filters.php
index f5c2da86e..c96bf1592 100644
--- a/src/classes/repositories/class-tainacan-filters.php
+++ b/src/classes/repositories/class-tainacan-filters.php
@@ -378,7 +378,7 @@ class Filters extends Repository {
$original_meta_q = isset( $args['meta_query'] ) ? $args['meta_query'] : [];
/**
- * Since we introduced roles & capabalities management, we can not rely
+ * Since we introduced roles & capabalities management, we cannot rely
* on WordPress behavior when handling default post status values.
* WordPress checks if the current user can read_priva_posts, but this is
* not enough for us. We have to handle this ourselves to mimic WordPress behavior
@@ -476,7 +476,7 @@ class Filters extends Repository {
$original_meta_q = isset( $args['meta_query'] ) ? $args['meta_query'] : [];
/**
- * Since we introduced roles & capabalities management, we can not rely
+ * Since we introduced roles & capabalities management, we cannot rely
* on WordPress behavior when handling default post status values.
* WordPress checks if the current user can read_priva_posts, but this is
* not enough for us. We have to handle this ourselves to mimic WordPress behavior
diff --git a/src/classes/repositories/class-tainacan-item-metadata.php b/src/classes/repositories/class-tainacan-item-metadata.php
index e1f1908f6..edaadaefe 100644
--- a/src/classes/repositories/class-tainacan-item-metadata.php
+++ b/src/classes/repositories/class-tainacan-item-metadata.php
@@ -165,7 +165,7 @@ class Item_Metadata extends Repository {
if ( $taxonomy ) {
- // We can not simply use wp_set_object_terms() because it uses term_exists() which is not reliable
+ // We cannot simply use wp_set_object_terms() because it uses term_exists() which is not reliable
// see https://core.trac.wordpress.org/ticket/45333 and https://core.trac.wordpress.org/ticket/47099
// $success = wp_set_object_terms( $item_metadata->get_item()->get_id(), $new_terms, $taxonomy->get_db_identifier() );
diff --git a/src/classes/repositories/class-tainacan-items.php b/src/classes/repositories/class-tainacan-items.php
index 88bb1ce55..3d60b5b24 100644
--- a/src/classes/repositories/class-tainacan-items.php
+++ b/src/classes/repositories/class-tainacan-items.php
@@ -265,7 +265,7 @@ class Items extends Repository {
$no_collection_set = false;
/**
- * We can not use $collections->fetch() here because facets
+ * We cannot use $collections->fetch() here because facets
* filter wp_query to just return the query and not the results
* See Repositories\Metadata::fetch_all_metadatum_values()
*
diff --git a/src/classes/repositories/class-tainacan-logs.php b/src/classes/repositories/class-tainacan-logs.php
index 3b0101790..3f9caf07b 100644
--- a/src/classes/repositories/class-tainacan-logs.php
+++ b/src/classes/repositories/class-tainacan-logs.php
@@ -33,15 +33,15 @@ class Logs extends Repository {
parent::__construct();
add_action( 'tainacan-pre-insert', array( $this, 'pre_insert_entity' ) );
-
+
add_action( 'tainacan-insert', array( $this, 'insert_entity' ) );
add_action( 'tainacan-deleted', array( $this, 'delete_entity' ), 10, 2 );
add_action( 'tainacan-pre-delete', array( $this, 'pre_delete_entity' ), 10, 2 );
-
+
add_action( 'add_attachment', array( $this, 'insert_attachment' ) );
add_action( 'delete_attachment', array( $this, 'pre_delete_attachment' ) );
add_action( 'delete_post', array( $this, 'delete_attachment' ) );
-
+
add_filter('tainacan-log-set-title', [$this, 'filter_log_title']);
}
@@ -108,7 +108,7 @@ class Logs extends Repository {
'object_id' => [
'map' => 'meta',
'title' => __( 'Log item relationship', 'tainacan' ),
- 'description' => __( 'The id of the object that this log is related to', 'tainacan' ),
+ 'description' => __( 'The ID of the object that this log is related to', 'tainacan' ),
],
'object_type' => [
'map' => 'meta',
@@ -117,7 +117,7 @@ class Logs extends Repository {
],
'old_value' => [
'map' => 'meta',
- 'title' => __( 'Old Value', 'tainacan' ),
+ 'title' => __( 'Old value', 'tainacan' ),
],
'new_value' => [
'map' => 'meta',
@@ -182,7 +182,7 @@ class Logs extends Repository {
* to learn all args accepted in the $args parameter (@see https://developer.wordpress.org/reference/classes/wp_query/)
* You can also use a mapped property, such as name and description, as an argument and it will be mapped to the
* appropriate WP_Query argument
- *
+ *
* If a number is passed to $args, it will return a \Tainacan\Entities\Log object. But if the post is not found or
* does not match the entity post type, it will return an empty array
*
@@ -193,7 +193,7 @@ class Logs extends Repository {
*/
public function fetch( $args = [], $output = null ) {
if ( is_numeric( $args ) ) {
-
+
$existing_post = get_post( $args );
if ( $existing_post instanceof \WP_Post ) {
try {
@@ -225,7 +225,7 @@ class Logs extends Repository {
public function update( $object, $new_values = null ) {
return $this->insert( $object );
}
-
+
/**
* Feth most recent log
* @return Entities\Log The most recent Log entity
@@ -255,11 +255,11 @@ class Logs extends Repository {
$entity = Repository::get_entity_by_post( $post );
if ( $entity ) { // attached to a tainacan entity
-
+
$log = new Entities\Log();
-
+
$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;
}
@@ -272,24 +272,24 @@ class Logs extends Repository {
$log->set_item_id($entity->get_id());
$log->set_title( sprintf( __( 'New file was attached to Item "%s"', 'tainacan'), $entity->get_title() ) );
}
-
+
$object_type = get_class($entity);
$object_id = $entity->get_id();
-
+
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
$log->set_action('new-attachment');
-
+
$prepared = [
'id' => $attachment->ID,
'title' => $attachment->post_title,
'description' => $attachment->post_content,
'mime_type' => $attachment->post_mime_type,
];
-
+
$log->set_new_value($prepared);
-
+
if ( $log->validate() ) {
$this->insert($log);
}
@@ -298,28 +298,28 @@ class Logs extends Repository {
}
}
-
+
/**
* Callback to generate log when attachments attached to any Tainacan entity are deleted
*/
public function pre_delete_attachment($attachment_id) {
-
+
$attachment_post = get_post($attachment_id);
-
+
$entity_post = get_post($attachment_post->post_parent);
if ( $entity_post ) {
try {
$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();
-
+
if ( $entity instanceof Entities\Collection ) {
$collection_id = $entity->get_id();
$log->set_title( sprintf(__( 'File attached to Collection "%s" was removed', 'tainacan'), $entity->get_name() ) );
@@ -328,32 +328,32 @@ class Logs extends Repository {
$log->set_item_id($entity->get_id());
$log->set_title( sprintf( __( 'File attached to Item "%s" was removed' , 'tainacan'), $entity->get_title() ) );
}
-
+
$object_type = get_class($entity);
$object_id = $entity->get_id();
-
+
$preapred = [
'id' => $attachment_id,
'title' => $attachment_post->post_title,
'description' => $attachment_post->post_content,
];
-
+
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
$log->set_old_value($preapred);
$log->set_action('delete-attachment');
-
+
$this->current_attachment_delete_log = $log;
-
+
}
} catch (\Exception $e) {
error_log("[pre_delete_attachment]:" . $e->getMessage());
}
-
+
}
}
-
+
/**
* Callback to generate log when attachments attached to any Tainacan entity are deleted
*/
@@ -366,7 +366,7 @@ class Logs extends Repository {
}
}
}
-
+
/**
* Compare two repository entities and sets the current_diff property to be used in the insert hook
*
@@ -379,20 +379,20 @@ class Logs extends Repository {
if ( ! $unsaved->get_repository()->use_logs ) {
return;
}
-
+
if ( $unsaved instanceof Entities\Item_Metadata_Entity ) {
return $this->prepare_item_metadata_diff($unsaved);
}
-
+
// do not log a log
if ( ( method_exists( $unsaved, 'get_post_type' ) && $unsaved->get_post_type() === 'tainacan-log' ) || $unsaved->get_status() === 'auto-draft' ) {
return;
}
-
+
$creating = true;
-
+
$old = null;
-
+
if ( is_numeric( $unsaved->get_id() ) ) {
if ( $unsaved instanceof Entities\Term ) {
$old = $unsaved->get_repository()->fetch( $unsaved->get_id(), $unsaved->get_taxonomy() );
@@ -400,78 +400,78 @@ class Logs extends Repository {
$old = $unsaved->get_repository()->fetch( $unsaved->get_id() );
}
}
-
-
+
+
if ( $old instanceof Entities\Entity ) {
-
+
if ( $old->get_status() !== 'auto-draft' ) {
$creating = false;
}
-
+
}
-
+
$diff = [
'old' => [],
'new' => []
];
-
+
$has_diff = false;
-
+
if ( $creating ) {
$diff['new'] = $unsaved->_toArray();
$has_diff = true;
} else {
$map = $unsaved->get_repository()->get_map();
-
+
foreach ( $map as $prop => $mapped ) {
if ( $old->get( $prop ) != $unsaved->get( $prop ) ) {
-
+
$diff['old'][$prop] = $old->get( $prop );
$diff['new'][$prop] = $unsaved->get( $prop );
$has_diff = true;
-
+
}
}
}
-
+
$diff = apply_filters( 'tainacan-entity-diff', $diff, $unsaved, $old );
-
+
$this->current_diff = $has_diff ? $diff : false;
$this->current_action = $creating ? 'create' : 'update';
-
+
}
-
-
+
+
private function prepare_item_metadata_diff( Entities\Entity $unsaved ) {
-
+
$diff = [
'old' => [],
'new' => []
];
-
+
$old = new Entities\Item_Metadata_Entity($unsaved->get_item(), $unsaved->get_metadatum());
-
+
add_filter('tainacan-item-metadata-get-multivalue-separator', [$this, '__temporary_multivalue_separator']);
-
+
if ( $old instanceof Entities\Item_Metadata_Entity ) {
$diff['old'] = \explode($this->__temporary_multivalue_separator(''), $old->get_value_as_string());
}
-
+
$diff['new'] = \explode($this->__temporary_multivalue_separator(''), $unsaved->get_value_as_string());
-
+
remove_filter('tainacan-item-metadata-get-multivalue-separator', [$this, '__temporary_multivalue_separator']);
-
+
$diff = apply_filters( 'tainacan-entity-diff', $diff, $unsaved, $old );
-
+
$this->current_diff = $diff;
$this->current_action = 'update-metadata-value';
-
+
}
-
+
public function __temporary_multivalue_separator($sep) {
return '--xx--';
}
-
+
/**
* Callback to generate log when Tainacan entities are edited
*/
@@ -480,31 +480,31 @@ class Logs extends Repository {
if ( ! $entity->get_repository()->use_logs ) {
return;
}
-
+
if ( $entity instanceof Entities\Item_Metadata_Entity ) {
return $this->insert_item_metadata($entity);
- }
-
+ }
+
// do not log a log
if ( ( method_exists( $entity, 'get_post_type' ) && $entity->get_post_type() === 'tainacan-log' ) || $entity->get_status() === 'auto-draft' ) {
return false;
}
-
+
$log = new Entities\Log();
$log->set_action($this->current_action);
-
+
$collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default';
-
+
$diff = $this->current_diff;
-
+
if (false === $diff) {
return;
}
-
+
if ( $entity instanceof Entities\Collection ) {
-
+
$collection_id = $entity->get_id();
-
+
if ($this->current_action == 'update') {
if (isset($diff['new']['metadata_order'])) {
$log->set_title( sprintf( __( 'Collection "%s" metadata order was updated', 'tainacan'), $entity->get_name() ) );
@@ -518,11 +518,11 @@ class Logs extends Repository {
} elseif ($this->current_action == 'create') {
$log->set_title( sprintf( __( 'Collection "%s" was created', 'tainacan'), $entity->get_name() ) );
}
-
+
} elseif ( $entity instanceof Entities\Item ) {
-
+
$log->set_item_id($entity->get_id());
-
+
if ($this->current_action == 'update') {
if (isset($diff['new']['document'])) {
$log->set_title( sprintf( __( 'Item "%s" document was updated', 'tainacan'), $entity->get_title() ) );
@@ -537,7 +537,7 @@ class Logs extends Repository {
$log->set_title( sprintf( __( 'Item "%1$s" was created with the ID %2$s', 'tainacan'), $entity->get_title(), $entity->get_id() ) );
}
} elseif ( $entity instanceof Entities\Filter ) {
-
+
if ( 'default' == $collection_id ) {
if ($this->current_action == 'update') {
$log->set_title( sprintf( __( 'Filter "%1$s" was updated in repository level', 'tainacan'), $entity->get_name() ) );
@@ -551,9 +551,9 @@ class Logs extends Repository {
$log->set_title( sprintf( __( 'Filter "%1$s" was added to Collection "%2$s"', 'tainacan'), $entity->get_name(), $entity->get_collection()->get_name() ) );
}
}
-
+
} elseif ( $entity instanceof Entities\Metadatum ) {
-
+
if ( 'default' == $collection_id ) {
if ($this->current_action == 'update') {
$log->set_title( sprintf( __( 'Metadatum "%s" was updated in repository level', 'tainacan'), $entity->get_name() ) );
@@ -567,99 +567,99 @@ class Logs extends Repository {
$log->set_title( sprintf( __( 'Metadatum "%1$s" was added to Collection "%2$s"', 'tainacan'), $entity->get_name(), $entity->get_collection()->get_name() ) );
}
}
-
+
} elseif ( $entity instanceof Entities\Taxonomy ) {
-
+
if ($this->current_action == 'update') {
$log->set_title( sprintf( __( 'Taxonomy "%s" was updated', 'tainacan'), $entity->get_name() ) );
} elseif ($this->current_action == 'create') {
$log->set_title( sprintf( __( 'Taxonomy "%1$s" was created', 'tainacan'), $entity->get_name() ) );
}
-
+
} elseif ( $entity instanceof Entities\Term ) {
-
+
$taxonomy = Taxonomies::get_instance()->fetch_by_db_identifier($entity->get_taxonomy());
$tax_name = '';
if ($taxonomy instanceof Entities\Taxonomy) {
$tax_name = $taxonomy->get_name();
}
-
+
if ($this->current_action == 'update') {
$log->set_title( sprintf( __( 'Term "%1$s" was updated in "%2$s" taxonomy', 'tainacan'), $entity->get_name(), $tax_name ) );
} elseif ($this->current_action == 'create') {
$log->set_title( sprintf( __( 'Term "%1$s" was added to "%2$s" taxonomy', 'tainacan'), $entity->get_name(), $tax_name ) );
}
-
+
}
-
+
$object_type = get_class($entity);
$object_id = $entity->get_id();
-
+
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
$log->set_old_value($diff['old']);
$log->set_new_value($diff['new']);
-
-
+
+
if ( $log->validate() ) {
$this->insert($log);
}
-
+
}
-
+
public function pre_delete_entity( Entities\Entity $entity, $permanent) {
-
+
if ( ! $entity->get_repository()->use_logs ) {
return;
}
-
+
// do not log a log
if ( ( method_exists( $entity, 'get_post_type' ) && $entity->get_post_type() === 'tainacan-log' ) || $entity->get_status() === 'auto-draft' ) {
return false;
}
-
+
$this->current_deleting_entity = $entity->_toArray();
$this->current_action = $permanent ? 'delete' : 'trash';
-
+
}
-
+
public function delete_entity( Entities\Entity $entity, $permanent) {
-
+
if ( ! $entity->get_repository()->use_logs ) {
return;
}
-
+
// do not log a log
if ( ( method_exists( $entity, 'get_post_type' ) && $entity->get_post_type() === 'tainacan-log' ) || $entity->get_status() === 'auto-draft' ) {
return false;
}
-
+
$log = new Entities\Log();
-
+
$collection_id = method_exists($entity, 'get_collection_id') ? $entity->get_collection_id() : 'default';
-
+
if ( $entity instanceof Entities\Collection ) {
-
+
$collection_id = $entity->get_id();
-
+
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Collection "%s" was permanently deleted', 'tainacan'), $entity->get_name() ) );
} elseif ($this->current_action == 'trash') {
$log->set_title( sprintf( __( 'Collection "%s" was moved to trash', 'tainacan'), $entity->get_name() ) );
}
-
+
} elseif ( $entity instanceof Entities\Item ) {
-
+
$log->set_item_id($entity->get_id());
-
+
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Item "%1$s" (ID %2$s) was updated', 'tainacan'), $entity->get_title(), $entity->get_id() ) );
} elseif ($this->current_action == 'trash') {
$log->set_title( sprintf( __( 'Item "%1$s" (ID %2$s) was moved to trash', 'tainacan'), $entity->get_title(), $entity->get_id() ) );
}
} elseif ( $entity instanceof Entities\Filter ) {
-
+
if ( 'default' == $collection_id ) {
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Filter "%s" was permanently deleted from the repository', 'tainacan'), $entity->get_name() ) );
@@ -673,9 +673,9 @@ class Logs extends Repository {
$log->set_title( sprintf( __( 'Filter "%1$s" was moved to trash in Collection "%2$s"', 'tainacan'), $entity->get_name(), $entity->get_collection()->get_name() ) );
}
}
-
+
} elseif ( $entity instanceof Entities\Metadatum ) {
-
+
if ( 'default' == $collection_id ) {
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Metadatum "%s" was permanently deleted from the repository', 'tainacan'), $entity->get_name() ) );
@@ -689,69 +689,69 @@ class Logs extends Repository {
$log->set_title( sprintf( __( 'Metadatum "%1$s" was moved to trash in Collection "%2$s"', 'tainacan'), $entity->get_name(), $entity->get_collection()->get_name() ) );
}
}
-
+
} elseif ( $entity instanceof Entities\Taxonomy ) {
-
+
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Taxonomy "%s" was permanently deleted', 'tainacan'), $entity->get_name() ) );
} elseif ($this->current_action == 'trash') {
$log->set_title( sprintf( __( 'Taxonomy "%1$s" was moved to trash', 'tainacan'), $entity->get_name() ) );
}
-
+
} elseif ( $entity instanceof Entities\Term ) {
-
+
$taxonomy = Taxonomies::get_instance()->fetch_by_db_identifier($entity->get_taxonomy());
$tax_name = '';
if ($taxonomy instanceof Entities\Taxonomy) {
$tax_name = $taxonomy->get_name();
}
-
+
if ($this->current_action == 'delete') {
$log->set_title( sprintf( __( 'Term "%1$s" was permanently deleted from "%2$s" taxonomy', 'tainacan'), $entity->get_name(), $tax_name ) );
} elseif ($this->current_action == 'trash') {
$log->set_title( sprintf( __( 'Term "%1$s" was moved to trash in "%2$s" taxonomy', 'tainacan'), $entity->get_name(), $tax_name ) );
}
-
+
}
-
-
+
+
$object_type = get_class($entity);
$object_id = $entity->get_id();
-
+
$diff = $this->current_diff;
-
+
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
$log->set_action($this->current_action);
-
+
if ( $permanent ) {
$log->set_old_value( $this->current_deleting_entity );
} else {
$log->set_old_value( ['status' => $entity->get_status()] );
$log->set_new_value( ['status' => 'trash'] );
}
-
-
+
+
if ( $log->validate() ) {
$this->insert($log);
}
-
+
}
-
+
private function insert_item_metadata( Entities\Item_Metadata_Entity $entity ) {
if($this->current_diff == false) {
return;
}
$log = new Entities\Log();
-
+
$item_id = $entity->get_item()->get_id();
$collection_id = $entity->get_item()->get_collection_id();
$object_type = get_class($entity);
$object_id = $entity->get_metadatum()->get_id();
-
+
$diff = $this->current_diff;
-
+
$log->set_collection_id($collection_id);
$log->set_object_type($object_type);
$log->set_object_id($object_id);
@@ -759,20 +759,20 @@ class Logs extends Repository {
$log->set_old_value($diff['old']);
$log->set_new_value($diff['new']);
$log->set_action($this->current_action);
-
+
$meta_name = $entity->get_metadatum()->get_name();
$item_title = $entity->get_item()->get_title();
-
+
$title = sprintf( __( 'Value for %1$s metadatum was updated in item "%2$s"', 'tainacan' ), $meta_name, $item_title );
-
+
$log->set_title($title);
-
+
if ( $log->validate() ) {
$this->insert($log);
}
-
+
}
-
+
public function filter_log_title($title) {
if (defined('TAINACAN_DOING_IMPORT') && true === TAINACAN_DOING_IMPORT) {
$_title = __('Importer', 'tainacan');
@@ -781,4 +781,4 @@ class Logs extends Repository {
return $title;
}
-}
\ No newline at end of file
+}
diff --git a/src/classes/repositories/class-tainacan-metadata.php b/src/classes/repositories/class-tainacan-metadata.php
index ee31ca850..ccba5ffca 100644
--- a/src/classes/repositories/class-tainacan-metadata.php
+++ b/src/classes/repositories/class-tainacan-metadata.php
@@ -114,7 +114,7 @@ class Metadata extends Repository {
'title' => __( 'Unique value', 'tainacan' ),
'type' => 'string',
'description' => __( 'Metadata value should be unique accross all items in this collection', 'tainacan' ),
- 'on_error' => __( 'You can not have two items with the same value for this metadatum', 'tainacan' ),
+ 'on_error' => __( 'You cannot have two items with the same value for this metadatum', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'default' => 'no'
],
@@ -412,7 +412,7 @@ class Metadata extends Repository {
$original_meta_q = isset( $args['meta_query'] ) ? $args['meta_query'] : [];
/**
- * Since we introduced roles & capabalities management, we can not rely
+ * Since we introduced roles & capabalities management, we cannot rely
* on WordPress behavior when handling default post status values.
* WordPress checks if the current user can read_priva_posts, but this is
* not enough for us. We have to handle this ourselves to mimic WordPress behavior
@@ -518,7 +518,7 @@ class Metadata extends Repository {
$original_meta_q = isset( $args['meta_query'] ) ? $args['meta_query'] : [];
/**
- * Since we introduced roles & capabalities management, we can not rely
+ * Since we introduced roles & capabalities management, we cannot rely
* on WordPress behavior when handling default post status values.
* WordPress checks if the current user can read_priva_posts, but this is
* not enough for us. We have to handle this ourselves to mimic WordPress behavior
diff --git a/src/classes/theme-helper/class-tainacan-theme-helper.php b/src/classes/theme-helper/class-tainacan-theme-helper.php
index f8751970b..c41295aad 100644
--- a/src/classes/theme-helper/class-tainacan-theme-helper.php
+++ b/src/classes/theme-helper/class-tainacan-theme-helper.php
@@ -407,7 +407,7 @@ class Theme_Helper {
* @type int $default_items_per_page Default number of items per page loaded
* @type bool $show_filters_button_inside_search_control Display the "hide filters" button inside of the search control instead of floating
* @type bool $start_with_filters_hidden Loads the filters list hidden from start
- * @type bool $filters_as_modal Display the filters as a modal instead of a collapsable region on desktop
+ * @type bool $filters_as_modal Display the filters as a modal instead of a collapsible region on desktop
* @type bool $show_inline_view_mode_options Display view modes as inline icon buttons instead of the dropdown
* @type bool $show_fullscreen_with_view_modes Lists fullscreen viewmodes alongside with other view modes istead of separatelly
* @type string $default_view_mode The default view mode
diff --git a/src/classes/theme-helper/template-tags.php b/src/classes/theme-helper/template-tags.php
index cbf581a23..1308d9995 100644
--- a/src/classes/theme-helper/template-tags.php
+++ b/src/classes/theme-helper/template-tags.php
@@ -686,7 +686,7 @@ function tainacan_is_view_mode_enabled($view_mode_slug) {
* @type int $default_items_per_page Default number of items per page loaded
* @type bool $show_filters_button_inside_search_control Display the "hide filters" button inside of the search control instead of floating
* @type bool $start_with_filters_hidden Loads the filters list hidden from start
- * @type bool $filters_as_modal Display the filters as a modal instead of a collapsable region on desktop
+ * @type bool $filters_as_modal Display the filters as a modal instead of a collapsible region on desktop
* @type bool $show_inline_view_mode_options Display view modes as inline icon buttons instead of the dropdown
* @type bool $show_fullscreen_with_view_modes Lists fullscreen viewmodes alongside with other view modes istead of separatelly
* @type string $default_view_mode The default view mode
diff --git a/src/views/admin/components/lists/processes-list.vue b/src/views/admin/components/lists/processes-list.vue
index 2ed2e6bf1..1bac3051d 100644
--- a/src/views/admin/components/lists/processes-list.vue
+++ b/src/views/admin/components/lists/processes-list.vue
@@ -77,11 +77,11 @@
show: 500,
hide: 300,
},
- content: bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process'),
+ content: bgProcess.name ? bgProcess.name : $i18n.get('label_unnamed_process'),
autoHide: false, classes: ['tainacan-tooltip', 'tooltip', 'repository-tooltip'],
placement: 'auto-start'
}">
- {{ bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process') }}
+ {{ bgProcess.name ? bgProcess.name : $i18n.get('label_unnamed_process') }}
get_multiple() != 'no') {
- return ['multiple' => __('Core Metadata can not accept multiple values', 'tainacan')];
+ return ['multiple' => __('Core Metadata cannot accept multiple values', 'tainacan')];
}
return true;
diff --git a/src/views/admin/components/metadata-types/core-title/class-tainacan-core-title.php b/src/views/admin/components/metadata-types/core-title/class-tainacan-core-title.php
index 893e7b43f..7ede12f06 100644
--- a/src/views/admin/components/metadata-types/core-title/class-tainacan-core-title.php
+++ b/src/views/admin/components/metadata-types/core-title/class-tainacan-core-title.php
@@ -75,7 +75,7 @@ class Core_Title extends Metadata_Type {
return true;
if ( $metadatum->get_multiple() != 'no') {
- return ['multiple' => __('Core Metadata can not accept multiple values', 'tainacan')];
+ return ['multiple' => __('Core Metadata cannot accept multiple values', 'tainacan')];
}
return true;
diff --git a/src/views/admin/components/metadata-types/metadata-type/class-tainacan-metadata-type.php b/src/views/admin/components/metadata-types/metadata-type/class-tainacan-metadata-type.php
index 1915fa02e..a8b289344 100644
--- a/src/views/admin/components/metadata-types/metadata-type/class-tainacan-metadata-type.php
+++ b/src/views/admin/components/metadata-types/metadata-type/class-tainacan-metadata-type.php
@@ -51,7 +51,7 @@ abstract class Metadata_Type {
* Indicates whether this is a core Metadatum Type or not
*
* Core metadatum types are used by Title, Description and Author metadata. These metadata:
- * * Can only be used once, they belong to the repository and can not be deleted
+ * * Can only be used once, they belong to the repository and cannot be deleted
* * Its values are saved in th wp_post table, and not as post_meta
*
*/
diff --git a/src/views/admin/components/other/processes-popup.vue b/src/views/admin/components/other/processes-popup.vue
index ab5182181..09d639899 100644
--- a/src/views/admin/components/other/processes-popup.vue
+++ b/src/views/admin/components/other/processes-popup.vue
@@ -51,7 +51,7 @@
class="tainacan-icon tainacan-icon-18px"
:class="{ 'tainacan-icon-arrowdown': processesCollapses[index], 'tainacan-icon-arrowright': !processesCollapses[index] }" />
- {{ bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process') }}
+ {{ bgProcess.name ? bgProcess.name : $i18n.get('label_unnamed_process') }}