diff options
author | ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org> | 2022-04-03 17:16:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-03 17:16:59 +0300 |
commit | 0d6cfca19cf9438986d7730904b2fde76a8cce36 (patch) | |
tree | aefb20eeae071f4a30967130d6e5bcf76785b98d /includes | |
parent | 1de256d8694b0ec7d4df2ac1d5976d4055e09d59 (diff) |
More hooks for the admin view & search (#3265)
Will fix #3074 and #3262
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Views/AdminParams.php | 13 | ||||
-rw-r--r-- | includes/functions-html.php | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/includes/Views/AdminParams.php b/includes/Views/AdminParams.php index 4ceb0b85..65356936 100644 --- a/includes/Views/AdminParams.php +++ b/includes/Views/AdminParams.php @@ -51,9 +51,11 @@ class AdminParams */ public function __construct() { - $this->possible_search_params = ['all', 'keyword', 'url', 'title', 'ip']; - $this->possible_sort_params = ['keyword', 'url', 'title', 'ip', 'timestamp', 'clicks']; - $this->params_translations = [ + $this->possible_search_params = yourls_apply_filter('admin_params_possible_search', + ['all', 'keyword', 'url', 'title', 'ip']); + $this->possible_sort_params = yourls_apply_filter('admin_params_possible_sort', + ['keyword', 'url', 'title', 'ip', 'timestamp', 'clicks']); + $this->params_translations = yourls_apply_filter('admin_params_possible_translations',[ 'all' => yourls__('All fields'), 'keyword' => yourls__('Short URL'), 'url' => yourls__('URL'), @@ -61,8 +63,9 @@ class AdminParams 'ip' => yourls__('IP Address'), 'timestamp' => yourls__('Date'), 'clicks' => yourls__('Clicks'), - ]; - $this->possible_date_sorting = ['before', 'after', 'between']; + ]); + $this->possible_date_sorting = yourls_apply_filter('admin_params_possible_date_sort', + ['before', 'after', 'between']); } /** diff --git a/includes/functions-html.php b/includes/functions-html.php index c88880a9..667cbe40 100644 --- a/includes/functions-html.php +++ b/includes/functions-html.php @@ -369,6 +369,8 @@ function yourls_html_tfooter( $params = array() ) { * @return string HTML content of the select element */ function yourls_html_select( $name, $options, $selected = '', $display = false, $label = '' ) { + // Allow plugins to filter the options -- see #3262 + $options = yourls_apply_filter( 'html_select_options', $options, $name, $selected, $display, $label ); $html = "<select aria-label='$label' name='$name' id='$name' size='1'>\n"; foreach( $options as $value => $text ) { $html .= "<option value='$value' "; |