Skip to content

Commit

Permalink
v 0.21.1
Browse files Browse the repository at this point in the history
- Update dependencies.
- Removed useless edit feature.
  • Loading branch information
Darklg committed Jun 16, 2024
1 parent 9a51bb6 commit 091e802
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 12 additions & 4 deletions inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
Class Name: WPU Base Admin Datas
Description: A class to handle datas in WordPress admin
Version: 4.0.0
Version: 4.1.0
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
Expand All @@ -23,6 +23,9 @@ class WPUBaseAdminDatas {
public $pagename;
public $tablename;
public $user_level = 'edit_posts';
private $slash_replacement = '#!#slash#!#';
private $labels_placeholder = '##_!_##labelsnumber##_!_##';

public $field_types = array(
'text',
'url',
Expand Down Expand Up @@ -447,6 +450,8 @@ public function delete_lines($lines = array()) {
---------------------------------------------------------- */

public function export_array_to_csv($array, $name) {
_deprecated_function('export_array_to_csv', '4.1.0');

if (isset($array[0])) {
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=export-list-' . sanitize_title($name) . '-' . date_i18n('y-m-d') . '.csv');
Expand Down Expand Up @@ -756,7 +761,7 @@ public function get_admin_table($values = array(), $args = array()) {
);
$url_items = $url_items_clear;
$url_items['pagenum'] = '%#%';
$url_items['where_text'] = $where_text;
$url_items['where_text'] = str_replace('\/', $this->slash_replacement, $where_text); # Avoid an agressive WP escaping

/* Back query used in single page */
$url_items_edit = $url_items;
Expand All @@ -782,6 +787,7 @@ public function get_admin_table($values = array(), $args = array()) {
}
$pagination .= '</div>';
if ($page_links) {
$page_links = str_replace($this->slash_replacement, '\/', $page_links);
$pagination .= '<div class="tablenav-pages alignright actions bulkactions">' . $page_links . '</div>';
}
$pagination .= '<br class="clear" /></div>';
Expand Down Expand Up @@ -834,8 +840,10 @@ public function get_admin_table($values = array(), $args = array()) {
$labels .= '<th></th>';
}
$labels .= '</tr>';
$content .= '<thead>' . sprintf($labels, 1) . '</thead>';
$content .= '<tfoot>' . sprintf($labels, 2) . '</tfoot>';

$labels = str_replace('%s', $this->labels_placeholder, $labels);
$content .= '<thead>' . str_replace($this->labels_placeholder, 1, $labels) . '</thead>';
$content .= '<tfoot>' . str_replace($this->labels_placeholder, 2, $labels) . '</tfoot>';
}
$content .= '<tbody id="the-list">';
foreach ($values as $id => $vals) {
Expand Down
10 changes: 4 additions & 6 deletions wpuactionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpuactionlogs
Update URI: https://github.com/WordPressUtilities/wpuactionlogs
Description: Useful logs about what’s happening on your website admin.
Version: 0.21.0
Version: 0.21.1
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpuactionlogs
Expand All @@ -26,7 +26,7 @@ class WPUActionLogs {
public $baseadmindatas;
public $settings_details;
public $settings;
private $plugin_version = '0.21.0';
private $plugin_version = '0.21.1';
private $plugin_settings = array(
'id' => 'wpuactionlogs',
'name' => 'WPU Action Logs',
Expand Down Expand Up @@ -359,11 +359,9 @@ public function page_content__main() {
echo '</select></p>';
}

$array_values = false; // ($array_values are automatically retrieved if not a valid array)
echo $this->baseadmindatas->get_admin_view(
$array_values,
echo $this->baseadmindatas->get_admin_table(
false,
array(
'is_admin_view' => true,
'perpage' => 50,
'columns' => array(
'id' => __('ID', 'wpuactionlogs'),
Expand Down

0 comments on commit 091e802

Please sign in to comment.