fix: indentation #436

This commit is contained in:
vnmedeiros 2020-10-30 10:07:04 -03:00
parent a5688775ec
commit dd5076e1bc
4 changed files with 41 additions and 45 deletions

View File

@ -5,25 +5,25 @@ use Tainacan;
use Tainacan\Entities;
class CSV extends Exporter {
private $collection_name;
private $collection_name;
public function __construct($attributes = array()) {
parent::__construct($attributes);
$this->set_accepted_mapping_methods('any'); // set all method to mapping
$this->accept_no_mapping = true;
if ($current_collection = $this->get_current_collection_object()) {
$name = $current_collection->get_name();
$this->collection_name = sanitize_title($name) . "_csv_export.csv";;
} else {
$this->collection_name = "csv_export.csv";
}
$name = $current_collection->get_name();
$this->collection_name = sanitize_title($name) . "_csv_export.csv";;
} else {
$this->collection_name = "csv_export.csv";
}
//$this->set_accepted_mapping_methods('list', [ "dublin-core" ]); // set specific list of methods to mapping
$this->set_default_options([
'delimiter' => ',',
'multivalued_delimiter' => '||',
'enclosure' => '"'
]);
'delimiter' => ',',
'multivalued_delimiter' => '||',
'enclosure' => '"'
]);
}
public function filter_multivalue_separator($separator) {
@ -278,7 +278,7 @@ class CSV extends Exporter {
public function options_form() {
ob_start();
?>
?>
<div class="field">
<label class="label"><?php _e('CSV Delimiter', 'tainacan'); ?></label>
<span class="help-wrapper">
@ -346,11 +346,7 @@ class CSV extends Exporter {
</div>
<?php
return ob_get_clean();
}
<?php
return ob_get_clean();
}
}

View File

@ -568,13 +568,13 @@ abstract class Exporter {
$processed_items = $this->get_items($current_collection_item, $collection_definition);
foreach ($processed_items as $processed_item) {
$init = microtime(true);
$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->add_log($time_log);
}
$this->process_footer($current_collection_item, $collection_definition);

View File

@ -83,16 +83,16 @@ class Bulk_Edit_Process extends Generic_Process {
}
public function get_output() {
$name = $this->get_bulk_collection_name();
$metadata = $this->get_changed_metadata();
$current_user = wp_get_current_user();
$author_name = $current_user->user_login;
$name = $this->get_bulk_edit_collection_name();
$metadata = $this->get_changed_metadata();
$current_user = wp_get_current_user();
$author_name = $current_user->user_login;
$title_label = __('Collection', 'tainacan');
$author_label = __('Edited by', 'tainacan');
$metadata_label = __('Changed metadata', 'tainacan');
$title_label = __('Collection', 'tainacan');
$author_label = __('Edited by', 'tainacan');
$metadata_label = __('Changed metadata', 'tainacan');
$message = __('Bulk edit finished', 'tainacan');
$message = __('Bulk edit finished', 'tainacan');
$message .= "<p> <strong> ${title_label}: </strong> ${name} </p>";
$message .= "<p> <strong> ${author_label}: </strong> ${author_name} </p>";
$message .= "<p> <strong> ${metadata_label}: </strong> ${metadata} </p>";
@ -100,26 +100,26 @@ class Bulk_Edit_Process extends Generic_Process {
return $message;
}
private function get_bulk_collection_name() {
$params = $this->get_options();
if ($params['collection_id']) {
$collection = $params['collection_id'];
$bulk_collection = Tainacan\Repositories\Collections::get_instance()->fetch($collection);
private function get_bulk_edit_collection_name() {
$params = $this->get_options();
if ($params['collection_id']) {
$collection = $params['collection_id'];
$bulk_collection = Tainacan\Repositories\Collections::get_instance()->fetch($collection);
if ($bulk_collection) {
return $bulk_collection->get_name();
}
}
if ($bulk_collection) {
return $bulk_collection->get_name();
}
}
return __('Collection', 'tainacan');
}
return __('Collection', 'tainacan');
}
private function get_changed_metadata() {
$metadatum_id = $this->bulk_edit_data['metadatum_id'];
$metadata = get_post($metadatum_id);
private function get_changed_metadata() {
$metadatum_id = $this->bulk_edit_data['metadatum_id'];
$metadata = get_post($metadatum_id);
return $metadata->post_title;
}
return $metadata->post_title;
}
public function set_bulk_edit_data($bulk_edit_data = false) {
$this->bulk_edit_data = $bulk_edit_data;

View File

@ -1023,7 +1023,7 @@ class CSV extends Importer {
$message = __('imported file:', 'tainacan');
$message .= " <b> ${imported_file} </b><br/>";
$message .= __('target collections:', 'tainacan');
$message .= __('target collections:', 'tainacan');
$message .= " <b>" . implode(", ", $this->get_collections_names() ) . "</b><br/>";
$message .= __('Imported by:', 'tainacan');
$message .= " <b> ${author} </b><br/>";