From 65b56dd9fd27b37d2710389015b8894bf47b5905 Mon Sep 17 00:00:00 2001 From: Ozh Date: Sun, 24 Mar 2013 20:12:40 +0000 Subject: [PATCH] l10n optimization: less strings, better strings git-svn-id: http://yourls.googlecode.com/svn/trunk@898 12232710-3e20-11de-b438-597f59cd7555 --- admin/index.php | 3 - includes/functions-html.php | 127 ++++++++++++++++++++++++------------ includes/functions-l10n.php | 2 +- yourls-infos.php | 8 +-- 4 files changed, 91 insertions(+), 49 deletions(-) diff --git a/admin/index.php b/admin/index.php index 1ebfc23..294b2ba 100644 --- a/admin/index.php +++ b/admin/index.php @@ -14,7 +14,6 @@ $search_in = 'url'; $sort_by_text = yourls__( 'Short URL' ); $sort_by = 'timestamp'; -$sort_order_text = yourls__( 'Descending Order' ); $sort_order = 'desc'; $page = ( isset( $_GET['page'] ) ? intval($_GET['page']) : 1 ); $search = ( isset( $_GET['search'] ) ? htmlspecialchars( trim($_GET['search']) ) : '' ); @@ -113,11 +112,9 @@ } switch( $_GET['sort_order'] ) { case 'asc': - $sort_order_text = yourls__( 'Ascending Order' ); $sort_order = 'asc'; break; case 'desc': - $sort_order_text = yourls__( 'Descending Order' ); $sort_order = 'desc'; break; } diff --git a/includes/functions-html.php b/includes/functions-html.php index 70f51a2..95195c9 100644 --- a/includes/functions-html.php +++ b/includes/functions-html.php @@ -197,50 +197,70 @@ function yourls_html_tfooter( $params = array() ) {
- - - - - – - - - - - – -
+ - - -
+ // First search control: text to search + $_input = ''; + $_options = array( + 'keyword' => yourls__( 'Short URL' ), + 'url' => yourls__( 'URL' ), + 'title' => yourls__( 'Title' ), + 'ip' => yourls__( 'IP' ), + ); + $_select = yourls_html_select( 'search_in', $_options, $search_in ); + /* //translators: "Search for in - - - - - - > & - /> + // Second search control: order by + $_options = array( + 'keyword' => yourls__( 'Short URL' ), + 'url' => yourls__( 'URL' ), + 'timestamp' => yourls__( 'Date' ), + 'ip' => yourls__( 'IP' ), + 'clicks' => yourls__( 'Clicks' ), + ); + $_select = yourls_html_select( 'sort_by', $_options, $sort_by ); + $sort_order = isset( $sort_order ) ? $sort_order : 'desc' ; + $_options = array( + 'asc' => yourls__( 'Ascending' ), + 'desc' => yourls__( 'Descending' ), + ); + $_select2 = yourls_html_select( 'sort_order', $_options, $sort_order ); + /* //translators: "Order by in " */ + yourls_se( 'Order by %1$s %2$s', $_select , $_select2 ); + echo "–\n"; + // Third search control: Show XX rows + /* //translators: "Show rows" */ + yourls_se( 'Show %s rows', '' ); + echo "
\n"; + + // Fourth search control: Show links with more than XX clicks + $_options = array( + 'more' => yourls__( 'more' ), + 'less' => yourls__( 'less' ), + ); + $_select = yourls_html_select( 'click_filter', $_options, $click_filter ); + $_input = ' '; + /* //translators: "Show links with than clicks" */ + yourls_se( 'Show links with %1$s than %2$s clicks', $_select, $_input ); + echo "
\n"; + + // Fifth search control: Show links created before/after/between ... + $_options = array( + 'before' => yourls__('before'), + 'after' => yourls__('after'), + 'between' => yourls__('between'), + ); + $_select = yourls_html_select( 'date_filter', $_options, $date_filter ); + $_input = ''; + $_and = ' and '; + $_input2 = ''; + /* //translators: "Show links created <"and" if applicable> " */ + yourls_se( 'Show links created %1$s %2$s %3$s %4$s', $_select, $_input, $_and, $_input2 ); + ?> +
  @@ -299,6 +319,31 @@ function yourls_html_tfooter( $params = array() ) { 'Text displayed' + * @param string $selected optional 'value' from the $options array that will be highlighted + * @param boolean $display false (default) to return, true to echo + * @return HTML content of the select element + */ +function yourls_html_select( $name, $options, $selected = '', $display = false ) { + $html = "