Skip to content

Commit

Permalink
v 3.1.0
Browse files Browse the repository at this point in the history
Admin Datas v 4.1.0 :
- Fixes on pagination.
- Fixes on accented search/filters.
- Deprecate old helper.
  • Loading branch information
Darklg committed Jun 16, 2024
1 parent 1f09ec8 commit b713fad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
namespace wpubaseadmindatas_4_0_0;
namespace wpubaseadmindatas_4_1_0;

/*
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
6 changes: 3 additions & 3 deletions wpubaseplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpubaseplugin
Update URI: https://github.com/WordPressUtilities/wpubaseplugin
Description: A framework for a WordPress plugin
Version: 3.0.0
Version: 3.1.0
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpubaseplugin
Expand All @@ -20,15 +20,15 @@

class WPUBasePlugin {

public $version = '3.0.0';
public $version = '3.1.0';

private $utilities_classes = array(
'messages' => array(
'namespace' => 'wpubasemessages_1_3_4',
'name' => 'WPUBaseMessages'
),
'admindatas' => array(
'namespace' => 'wpubaseadmindatas_4_0_0',
'namespace' => 'wpubaseadmindatas_4_1_0',
'name' => 'WPUBaseAdminDatas'
),
'adminpage' => array(
Expand Down

0 comments on commit b713fad

Please sign in to comment.