diff --git a/inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php b/inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php index 7c0fc3a..d2f96a8 100644 --- a/inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php +++ b/inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php @@ -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/ @@ -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', @@ -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'); @@ -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; @@ -782,6 +787,7 @@ public function get_admin_table($values = array(), $args = array()) { } $pagination .= ''; if ($page_links) { + $page_links = str_replace($this->slash_replacement, '\/', $page_links); $pagination .= '
' . $page_links . '
'; } $pagination .= '
'; @@ -834,8 +840,10 @@ public function get_admin_table($values = array(), $args = array()) { $labels .= ''; } $labels .= ''; - $content .= '' . sprintf($labels, 1) . ''; - $content .= '' . sprintf($labels, 2) . ''; + + $labels = str_replace('%s', $this->labels_placeholder, $labels); + $content .= '' . str_replace($this->labels_placeholder, 1, $labels) . ''; + $content .= '' . str_replace($this->labels_placeholder, 2, $labels) . ''; } $content .= ''; foreach ($values as $id => $vals) { diff --git a/wpuactionlogs.php b/wpuactionlogs.php index 2304ab7..09e1e8b 100644 --- a/wpuactionlogs.php +++ b/wpuactionlogs.php @@ -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 @@ -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', @@ -359,11 +359,9 @@ public function page_content__main() { echo '

'; } - $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'),