示例#1
0
/**
 * Display main table's footer
 *
 * The $param array is defined in /admin/index.php, check the yourls_html_tfooter() call
 *
 * @param array $params Array of all required parameters
 * @return string Result
 */
function yourls_html_tfooter($params = array())
{
    extract($params);
    // extract $search_text, $page, $search_in ...
    ?>
	<tfoot>
		<tr>
			<th colspan="6">
			<div id="filter_form">
				<form action="" method="get">
					<div id="filter_options">
						<?php 
    // First search control: text to search
    $_input = '<input type="text" name="search" class="text" size="12" value="' . yourls_esc_attr($search_text) . '" />';
    $_options = array('all' => yourls__('All fields'), '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 <input field with text to search> in <select dropdown with URL, title...>" */
    yourls_se('Search for %1$s in %2$s', $_input, $_select);
    echo "&ndash;\n";
    // 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 <criteria dropdown (date, clicks...)> in <order dropdown (Descending or Ascending)>" */
    yourls_se('Order by %1$s %2$s', $_select, $_select2);
    echo "&ndash;\n";
    // Third search control: Show XX rows
    /* //translators: "Show <text field> rows" */
    yourls_se('Show %s rows', '<input type="text" name="perpage" class="text" size="2" value="' . $perpage . '" />');
    echo "<br/>\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 = '<input type="text" name="click_limit" class="text" size="4" value="' . $click_limit . '" /> ';
    /* //translators: "Show links with <more/less> than <text field> clicks" */
    yourls_se('Show links with %1$s than %2$s clicks', $_select, $_input);
    echo "<br/>\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 = '<input type="text" name="date_first" id="date_first" class="text" size="12" value="' . $date_first . '" />';
    $_and = '<span id="date_and"' . ($date_filter === 'between' ? ' style="display:inline"' : '') . '> &amp; </span>';
    $_input2 = '<input type="text" name="date_second" id="date_second" class="text" size="12" value="' . $date_second . '"' . ($date_filter === 'between' ? ' style="display:inline"' : '') . '/>';
    /* //translators: "Show links created <before/after/between> <date input> <"and" if applicable> <date input if applicable>" */
    yourls_se('Show links created %1$s %2$s %3$s %4$s', $_select, $_input, $_and, $_input2);
    ?>

						<div id="filter_buttons">
							<input type="submit" id="submit-sort" value="<?php 
    yourls_e('Search');
    ?>
" class="button primary" />
							&nbsp;
							<input type="button" id="submit-clear-filter" value="<?php 
    yourls_e('Clear');
    ?>
" class="button" onclick="window.parent.location.href = 'index.php'" />
						</div>
				
					</div>
				</form>
			</div>
			
			<?php 
    // Remove empty keys from the $params array so it doesn't clutter the pagination links
    $params = array_filter($params, 'yourls_return_if_not_empty_string');
    // remove empty keys
    if (isset($search_text)) {
        $params['search'] = $search_text;
        unset($params['search_text']);
    }
    ?>
			
			<div id="pagination">
				<span class="navigation">
				<?php 
    if ($total_pages > 1) {
        ?>
					<span class="nav_total"><?php 
        echo sprintf(yourls_n('1 page', '%s pages', $total_pages), $total_pages);
        ?>
</span>
					<?php 
        $base_page = yourls_admin_url('index.php');
        // Pagination offsets: min( max ( zomg! ) );
        $p_start = max(min($total_pages - 4, $page - 2), 1);
        $p_end = min(max(5, $page + 2), $total_pages);
        if ($p_start >= 2) {
            $link = yourls_add_query_arg(array_merge($params, array('page' => 1)), $base_page);
            echo '<span class="nav_link nav_first"><a href="' . $link . '" title="' . yourls_esc_attr__('Go to First Page') . '">' . yourls__('&laquo; First') . '</a></span>';
            echo '<span class="nav_link nav_prev"></span>';
        }
        for ($i = $p_start; $i <= $p_end; $i++) {
            if ($i == $page) {
                echo "<span class='nav_link nav_current'>{$i}</span>";
            } else {
                $link = yourls_add_query_arg(array_merge($params, array('page' => $i)), $base_page);
                echo '<span class="nav_link nav_goto"><a href="' . $link . '" title="' . sprintf(yourls_esc_attr('Page %s'), $i) . '">' . $i . '</a></span>';
            }
        }
        if ($p_end < $total_pages) {
            $link = yourls_add_query_arg(array_merge($params, array('page' => $total_pages)), $base_page);
            echo '<span class="nav_link nav_next"></span>';
            echo '<span class="nav_link nav_last"><a href="' . $link . '" title="' . yourls_esc_attr__('Go to Last Page') . '">' . yourls__('Last &raquo;') . '</a></span>';
        }
        ?>
				<?php 
    }
    ?>
				</span>
			</div>
			</th>
		</tr>
		<?php 
    yourls_do_action('html_tfooter');
    ?>
	</tfoot>
	<?php 
}
示例#2
0
文件: tools.php 项目: GasmoN/yourls
		<tt><?php 
    echo YOURLS_SITE;
    ?>
/yourls-api.php?timestamp=<?php 
    echo $time;
    ?>
&signature=<?php 
    echo $sign;
    ?>
&action=...</tt></p>
		<p><?php 
    yourls_se('This URL would be valid for only %s seconds', YOURLS_NONCE_LIFE);
    ?>
</p>
		</li>
	</ul>
	
	<p><?php 
    yourls_se('See the <a href="%s">API documentation</a> for more', YOURLS_SITE . '/readme.html#API');
    ?>
</p>

	</div>

	<?php 
}
// end is private
?>

<?php 
yourls_html_footer();
示例#3
0
	<h2><?php 
yourls_e('Plugins');
?>
</h2>
	
	<?php 
$plugins = (array) yourls_get_plugins();
uasort($plugins, 'yourls_plugins_sort_callback');
$count = count($plugins);
$plugins_count = sprintf(yourls_n('%s plugin', '%s plugins', $count), $count);
$count_active = yourls_has_active_plugins();
?>
	
	<p id="plugin_summary"><?php 
/* //translators: "you have '3 plugins' installed and '1' activated" */
yourls_se('You currently have <strong>%1$s</strong> installed, and <strong>%2$s</strong> activated', $plugins_count, $count_active);
?>
</p>

	<table id="main_table" class="tblSorter" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<th><?php 
yourls_e('Plugin Name');
?>
</th>
			<th><?php 
yourls_e('Version');
?>
</th>
			<th><?php