3 // Display <h1> header and logo
\r
4 function yourls_html_logo() {
\r
5 yourls_do_action( 'pre_html_logo' );
\r
8 <a href="<?php echo yourls_admin_url('index.php') ?>" title="YOURLS"><span>YOURLS</span>: <span>Y</span>our <span>O</span>wn <span>URL</span> <span>S</span>hortener<br/>
\r
9 <img src="<?php yourls_site_url(); ?>/images/yourls-logo.png" alt="YOURLS" title="YOURLS" border="0" style="border: 0px;" /></a>
\r
12 yourls_do_action( 'html_logo' );
\r
15 // Display HTML head and <body> tag
\r
16 function yourls_html_head( $context = 'index', $title = '' ) {
\r
17 // All components to false, except when specified true
\r
18 $share = $insert = $tablesorter = $tabs = $cal = false;
\r
20 // Load components as needed
\r
21 switch ( $context ) {
\r
23 $share = $tabs = true;
\r
27 $share = $insert = $tablesorter = true;
\r
31 $insert = $tablesorter = $cal = $share = true;
\r
36 $tablesorter = true;
\r
46 // Force no cache for all admin pages
\r
47 if( yourls_is_admin() && !headers_sent() ) {
\r
48 header( 'Expires: Thu, 23 Mar 1972 07:00:00 GMT' );
\r
49 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
\r
50 header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
\r
51 header( 'Pragma: no-cache' );
\r
52 yourls_do_action( 'admin_headers' );
\r
57 $bodyclass .= ( yourls_is_mobile_device() ? 'mobile' : 'desktop' );
\r
60 $_title = 'YOURLS — Your Own URL Shortener | ' . yourls_link();
\r
61 $title = $title ? $title . " « " . $_title : $_title;
\r
62 $title = yourls_apply_filter( 'html_title', $title, $context );
\r
65 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\r
66 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
\r
68 <title><?php echo $title ?></title>
\r
69 <link rel="icon" type="image/gif" href="<?php yourls_site_url(); ?>/images/favicon.gif" />
\r
70 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
71 <meta http-equiv="X-UA-Compatible" content="chrome=1" />
\r
72 <meta name="author" content="Ozh RICHARD & Lester CHAN for http://yourls.org/" />
\r
73 <meta name="generator" content="YOURLS <?php echo YOURLS_VERSION ?>" />
\r
74 <meta name="description" content="Insert URL « YOURLS » Your Own URL Shortener' | <?php yourls_site_url(); ?>" />
\r
75 <script src="<?php yourls_site_url(); ?>/js/jquery-1.4.3.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
76 <script src="<?php yourls_site_url(); ?>/js/common.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
77 <script src="<?php yourls_site_url(); ?>/js/jquery.notifybar.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
78 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/style.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
79 <?php if ($tabs) { ?>
\r
80 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/infos.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
81 <script src="<?php yourls_site_url(); ?>/js/infos.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
83 <?php if ($tablesorter) { ?>
\r
84 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/tablesorter.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
85 <script src="<?php yourls_site_url(); ?>/js/jquery.tablesorter.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
87 <?php if ($insert) { ?>
\r
88 <script src="<?php yourls_site_url(); ?>/js/insert.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
90 <?php if ($share) { ?>
\r
91 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
92 <script src="<?php yourls_site_url(); ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
93 <script src="<?php yourls_site_url(); ?>/js/ZeroClipboard.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
94 <script type="text/javascript">ZeroClipboard.setMoviePath( '<?php yourls_site_url(); ?>/js/ZeroClipboard.swf' );</script>
\r
96 <?php if ($cal) { ?>
\r
97 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/cal.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
98 <script src="<?php yourls_site_url(); ?>/js/jquery.cal.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
100 <script type="text/javascript">
\r
102 var ajaxurl = '<?php echo yourls_admin_url( 'admin-ajax.php' ); ?>';
\r
105 <?php yourls_do_action( 'html_head', $context ); ?>
\r
107 <body class="<?php echo $context; ?> <?php echo $bodyclass; ?>">
\r
112 // Display HTML footer (including closing body & html tags)
\r
113 function yourls_html_footer() {
\r
116 $num_queries = $ydb->num_queries > 1 ? $ydb->num_queries.' queries' : $ydb->num_queries.' query';
\r
118 </div> <?php // wrap ?>
\r
119 <div id="footer"><p>Powered by <a href="http://yourls.org/" title="YOURLS">YOURLS</a> v<?php echo YOURLS_VERSION; echo ' – '.$num_queries; ?></p></div>
\r
120 <?php if( defined('YOURLS_DEBUG') && YOURLS_DEBUG == true ) {
\r
121 echo '<p>'. $ydb->all_queries .'<p>';
\r
123 <?php yourls_do_action( 'html_footer' ); ?>
\r
129 // Display "Add new URL" box
\r
130 function yourls_html_addnew( $url = '', $keyword = '' ) {
\r
131 $url = $url ? $url : 'http://';
\r
135 <form id="new_url_form" action="" method="get">
\r
136 <div><strong>Enter the URL</strong>:<input type="text" id="add-url" name="url" value="<?php echo $url; ?>" class="text" size="80" />
\r
137 Optional: <strong>Custom short URL</strong>:<input type="text" id="add-keyword" name="keyword" value="<?php echo $keyword; ?>" class="text" size="8" />
\r
138 <?php yourls_nonce_field( 'add_url', 'nonce-add' ); ?>
\r
139 <input type="button" id="add-button" name="add-button" value="Shorten The URL" class="button" onclick="add();" /></div>
\r
141 <div id="feedback" style="display:none"></div>
\r
143 <?php yourls_do_action( 'html_addnew' ); ?>
\r
148 // Display main table's footer
\r
149 function yourls_html_tfooter( $params = array() ) {
\r
150 extract( $params ); // extract $search_text, $page, $search_in_sql ...
\r
155 <th colspan="4" style="text-align: left;">
\r
156 <form action="" method="get">
\r
158 Search for
\r
159 <input type="text" name="s_search" class="text" size="20" value="<?php echo $search_text; ?>" />
\r
161 <select name="s_in" size="1">
\r
162 <option value="keyword"<?php if($search_in_sql == 'keyword') { echo ' selected="selected"'; } ?>>Short URL</option>
\r
163 <option value="url"<?php if($search_in_sql == 'url') { echo ' selected="selected"'; } ?>>URL</option>
\r
164 <option value="title"<?php if($search_in_sql == 'title') { echo ' selected="selected"'; } ?>>Title</option>
\r
165 <option value="ip"<?php if($search_in_sql == 'ip') { echo ' selected="selected"'; } ?>>IP</option>
\r
167 – Order by
\r
168 <select name="s_by" size="1">
\r
169 <option value="id"<?php if($sort_by_sql == 'keyword') { echo ' selected="selected"'; } ?>>Short URL</option>
\r
170 <option value="url"<?php if($sort_by_sql == 'url') { echo ' selected="selected"'; } ?>>URL</option>
\r
171 <option value="timestamp"<?php if($sort_by_sql == 'timestamp') { echo ' selected="selected"'; } ?>>Date</option>
\r
172 <option value="ip"<?php if($sort_by_sql == 'ip') { echo ' selected="selected"'; } ?>>IP</option>
\r
173 <option value="clicks"<?php if($sort_by_sql == 'clicks') { echo ' selected="selected"'; } ?>>Clicks</option>
\r
175 <select name="s_order" size="1">
\r
176 <option value="asc"<?php if($sort_order_sql == 'asc') { echo ' selected="selected"'; } ?>>Ascending</option>
\r
177 <option value="desc"<?php if($sort_order_sql == 'desc') { echo ' selected="selected"'; } ?>>Descending</option>
\r
179 – Show
\r
180 <input type="text" name="perpage" class="text" size="2" value="<?php echo $perpage; ?>" /> rows<br/>
\r
183 <select name="link_filter" size="1">
\r
184 <option value="more"<?php if($link_filter === 'more') { echo ' selected="selected"'; } ?>>more</option>
\r
185 <option value="less"<?php if($link_filter === 'less') { echo ' selected="selected"'; } ?>>less</option>
\r
188 <input type="text" name="link_limit" class="text" size="4" value="<?php echo $link_limit; ?>" />clicks<br/>
\r
191 <select name="date_filter" id="date_filter" size="1">
\r
192 <option value="before"<?php if($date_filter === 'before') { echo ' selected="selected"'; } ?>>before</option>
\r
193 <option value="after"<?php if($date_filter === 'after') { echo ' selected="selected"'; } ?>>after</option>
\r
194 <option value="between"<?php if($date_filter === 'between') { echo ' selected="selected"'; } ?>> between</option>
\r
196 <input type="text" name="date_first" id="date_first" class="text" size="12" value="<?php echo $date_first; ?>" />
\r
197 <span id="date_and" <?php if($date_filter === 'between') { echo ' style="display:inline"'; } ?>> and </span>
\r
198 <input type="text" name="date_second" id="date_second" class="text" size="12" value="<?php echo $date_second; ?>" <?php if($date_filter === 'between') { echo ' style="display:inline"'; } ?>/>
\r
200 <div style="float:right;">
\r
201 <input type="submit" id="submit-sort" value="Filter" class="button primary" />
\r
203 <input type="button" id="submit-clear-filter" value="Clear Filter" class="button" onclick="window.parent.location.href = 'index.php'" />
\r
210 <th colspan="3" style="text-align: right;">
\r
211 Pages (<?php echo $total_pages; ?>):
\r
214 echo '<b><a href="'.$base_page.'?s_by='.$sort_by_sql.'&s_order='.$sort_order_sql.$search_url.'&perpage='.$perpage.'&page=1'.'" title="Go to First Page">« First</a></b> ... ';
\r
217 echo ' <b><a href="'.$base_page.'?s_by='.$sort_by_sql.'&s_order='.$sort_order_sql.$search_url.'&perpage='.$perpage.'&page='.($page-1).'" title="« Go to Page '.($page-1).'">«</a></b> ';
\r
219 for($i = $page - 2 ; $i <= $page +2; $i++) {
\r
220 if ($i >= 1 && $i <= $total_pages) {
\r
222 echo "<strong>[$i]</strong> ";
\r
224 echo '<a href="'.$base_page.'?s_by='.$sort_by_sql.'&s_order='.$sort_order_sql.$search_url.'&perpage='.$perpage.'&page='.($i).'" title="Page '.$i.'">'.$i.'</a> ';
\r
228 if($page < $total_pages) {
\r
229 echo ' <b><a href="'.$base_page.'?s_by='.$sort_by_sql.'&s_order='.$sort_order_sql.$search_url.'&perpage='.$perpage.'&page='.($page+1).'" title="Go to Page '.($page+1).' »">»</a></b> ';
\r
231 if (($page+2) < $total_pages) {
\r
232 echo ' ... <b><a href="'.$base_page.'?s_by='.$sort_by_sql.'&s_order='.$sort_order_sql.$search_url.'&perpage='.$perpage.'&page='.($total_pages).'" title="Go to Last Page">Last »</a></b>';
\r
237 <?php yourls_do_action( 'html_tfooter' ); ?>
\r
242 // Display the Quick Share box
\r
243 function yourls_share_box( $longurl, $shorturl, $title='', $text='', $shortlink_title = '<h2>Your short link</h2>', $share_title = '<h2>Quick Share</h2>', $hidden = false ) {
\r
244 $text = ( $text ? '"'.$text.'" ' : '' );
\r
245 $title = ( $title ? "$title " : '' );
\r
246 $share = htmlspecialchars_decode( $title.$text.$shorturl );
\r
247 $_share = rawurlencode( $share );
\r
248 $_url = rawurlencode( $shorturl );
\r
249 $count = 140 - strlen( $share );
\r
251 $hidden = ( $hidden ? 'style="display:none;"' : '' );
\r
254 <div id="shareboxes" <?php echo $hidden; ?>>
\r
256 <?php yourls_do_action( 'shareboxes_before', $longurl, $shorturl, $title, $text ); ?>
\r
258 <div id="copybox" class="share">
\r
259 <?php echo $shortlink_title; ?>
\r
260 <p><input id="copylink" class="text" size="40" value="<?php echo $shorturl; ?>" /></p>
\r
261 <p><small>Long link: <a id="origlink" href="<?php echo $longurl; ?>"><?php echo $longurl; ?></a></small>
\r
262 <?php if( yourls_do_log_redirect() ) { ?>
\r
263 <br/><small>Stats: <a id="statlink" href="<?php echo $shorturl; ?>+"><?php echo $shorturl; ?>+</a></small>
\r
264 <input type="hidden" id="titlelink" value="<?php echo $title; ?>" />
\r
269 <?php yourls_do_action( 'shareboxes_middle', $longurl, $shorturl, $title, $text ); ?>
\r
271 <div id="sharebox" class="share">
\r
272 <?php echo $share_title; ?>
\r
274 <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span>
\r
275 <textarea id="tweet_body"><?php echo $share; ?></textarea>
\r
277 <p id="share_links">Share with
\r
278 <a id="share_tw" href="http://twitter.com/home?status=<?php echo $_share; ?>" title="Tweet this!" onclick="share('tw');return false">Twitter</a>
\r
279 <a id="share_fb" href="http://www.facebook.com/share.php?u=<?php echo $_url; ?>" title="Share on Facebook" onclick="share('fb');return false;">Facebook</a>
\r
280 <a id="share_ff" href="http://friendfeed.com/share/bookmarklet/frame#title=<?php echo $_share; ?>" title="Share on Friendfeed" onclick="javascript:share('ff');return false;">FriendFeed</a>
\r
282 yourls_do_action( 'share_links', $longurl, $shorturl, $title, $text );
\r
287 <?php yourls_do_action( 'shareboxes_after', $longurl, $shorturl, $title, $text ); ?>
\r
296 function yourls_die( $message = '', $title = '', $header_code = 200 ) {
\r
297 yourls_status_header( $header_code );
\r
299 yourls_html_head();
\r
300 yourls_html_logo();
\r
301 echo yourls_apply_filter( 'die_title', "<h2>$title</h2>" );
\r
302 echo yourls_apply_filter( 'die_message', "<p>$message</p>" );
\r
303 yourls_do_action( 'yourls_die' );
\r
304 yourls_html_footer();
\r
308 // Add the "Edit" row
\r
309 function yourls_table_edit_row( $keyword ) {
\r
312 $table = YOURLS_DB_TABLE_URL;
\r
313 $keyword = yourls_sanitize_string( $keyword );
\r
314 $id = yourls_string2htmlid( $keyword ); // used as HTML #id
\r
315 $url = yourls_get_keyword_longurl( $keyword );
\r
316 $title = htmlspecialchars( yourls_get_keyword_title( $keyword ) );
\r
317 $safe_url = stripslashes( $url );
\r
318 $safe_title = stripslashes( $title );
\r
319 $www = yourls_link();
\r
321 $save_link = yourls_nonce_url( 'save-link_'.$id,
\r
322 yourls_add_query_arg( array( 'id' => $id, 'action' => 'edit_save', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
325 $nonce = yourls_create_nonce( 'edit-save_'.$id );
\r
328 $return = <<<RETURN
\r
329 <tr id="edit-$id" class="edit-row"><td colspan="5"><strong>Original URL</strong>:<input type="text" id="edit-url-$id" name="edit-url-$id" value="$safe_url" class="text" size="70" /> <strong>Short URL</strong>: $www<input type="text" id="edit-keyword-$id" name="edit-keyword-$id" value="$keyword" class="text" size="10" /><br/><strong>Title</strong>: <input type="text" id="edit-title-$id" name="edit-title-$id" value="$title" class="text" size="60" /></td><td colspan="1"><input type="button" id="edit-submit-$id" name="edit-submit-$id" value="Save" title="Save new values" class="button" onclick="edit_save('$id');" /> <input type="button" id="edit-close-$id" name="edit-close-$id" value="X" title="Cancel editing" class="button" onclick="hide_edit('$id');" /><input type="hidden" id="old_keyword_$id" value="$keyword"/><input type="hidden" id="nonce_$id" value="$nonce"/></td></tr>
\r
332 $return = '<tr><td colspan="6">Error, URL not found</td></tr>';
\r
335 $return = yourls_apply_filter( 'table_edit_row', $return, $keyword, $url, $title );
\r
341 function yourls_table_add_row( $keyword, $url, $title = '', $ip, $clicks, $timestamp ) {
\r
342 $keyword = yourls_sanitize_string( $keyword );
\r
343 $display_keyword = htmlentities( $keyword );
\r
345 $url = yourls_sanitize_url( $url );
\r
346 $display_url = htmlentities( yourls_trim_long_string( $url ) );
\r
347 $title_url = htmlspecialchars( $url );
\r
349 $title = yourls_sanitize_title( $title ) ;
\r
350 $display_title = yourls_trim_long_string( $title );
\r
351 $title = htmlspecialchars( $title );
\r
353 $id = yourls_string2htmlid( $keyword ); // used as HTML #id
\r
354 $date = date( 'M d, Y H:i', $timestamp+( YOURLS_HOURS_OFFSET * 3600 ) );
\r
355 $clicks = number_format( $clicks, 0, '', '' );
\r
357 $shorturl = yourls_link( $keyword );
\r
358 $statlink = yourls_statlink( $keyword );
\r
359 if( yourls_is_ssl() )
\r
360 $statlink = str_replace( 'http://', 'https://', $statlink );
\r
363 $display_link = "<a href=\"$url\" title=\"$title\">$display_title</a><br/><small><a href=\"$url\" title=\"$title_url\">$display_url</a></small>";
\r
365 $display_link = "<a href=\"$url\" title=\"$title_url\">$display_url</a>";
\r
368 $delete_link = yourls_nonce_url( 'delete-link_'.$id,
\r
369 yourls_add_query_arg( array( 'id' => $id, 'action' => 'delete', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
372 $edit_link = yourls_nonce_url( 'edit-link_'.$id,
\r
373 yourls_add_query_arg( array( 'id' => $id, 'action' => 'edit', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
376 // Action button links
\r
379 'href' => $statlink,
\r
380 'id' => "statlink-$id",
\r
381 'title' => 'Stats',
\r
382 'anchor' => 'Stats',
\r
386 'id' => "share-button-$id",
\r
387 'title' => 'Share',
\r
388 'anchor' => 'Share',
\r
389 'onclick' => "toggle_share('$id');return false;",
\r
392 'href' => $edit_link,
\r
393 'id' => "edit-button-$id",
\r
395 'anchor' => 'Edit',
\r
396 'onclick' => "edit('$id');return false;",
\r
399 'href' => $delete_link,
\r
400 'id' => "delete-button-$id",
\r
401 'title' => 'Delete',
\r
402 'anchor' => 'Delete',
\r
403 'onclick' => "remove('$id');return false;",
\r
406 $actions = yourls_apply_filter( 'table_add_row_action_array', $actions );
\r
407 $action_links = '';
\r
408 foreach( $actions as $key => $action ) {
\r
409 $onclick = isset( $action['onclick'] ) ? 'onclick="' . $action['onclick'] . '"' : '' ;
\r
410 $action_links .= sprintf( '<a href="%s" id="%s" title="%s" class="%s" %s>%s</a>',
\r
411 $action['href'], $action['id'], $action['title'], 'button button_'.$key, $onclick, $action['anchor']
\r
414 $action_links = yourls_apply_filter( 'action_links', $action_links, $keyword, $url, $ip, $clicks, $timestamp );
\r
417 <tr id="id-$id"><td id="keyword-$id" class="keyword"><a href="$shorturl">$display_keyword</a></td><td id="url-$id" class="url">$display_link</td><td id="timestamp-$id" class="timestamp">$date</td><td id="ip-$id" class="ip">$ip</td><td id="clicks-$id" class="clicks">$clicks</td><td class="actions" id="actions-$id">$action_links<input type="hidden" id="keyword_$id" value="$keyword"/></td></tr>
\r
419 $row = yourls_apply_filter( 'table_add_row', $row, $keyword, $url, $title, $ip, $clicks, $timestamp );
\r
424 // Echo the main table head
\r
425 function yourls_table_head() {
\r
426 $start = '<table id="main_table" class="tblSorter" cellpadding="0" cellspacing="1"><thead><tr>'."\n";
\r
427 echo yourls_apply_filter( 'table_head_start', $start );
\r
429 $cells = yourls_apply_filter( 'table_head_cells', array(
\r
430 'shorturl' => 'Short URL ',
\r
431 'longurl' => 'Original URL',
\r
434 'clicks' => 'Clicks ',
\r
435 'actions' => 'Actions'
\r
437 foreach( $cells as $k => $v ) {
\r
438 echo "<th id='main_table_head_$k'>$v</th>\n";
\r
441 $end = "</tr></thead>\n";
\r
442 echo yourls_apply_filter( 'table_head_end', $end );
\r
445 // Echo the tbody start tag
\r
446 function yourls_table_tbody_start() {
\r
447 echo yourls_apply_filter( 'table_tbody_start', '<tbody>' );
\r
450 // Echo the tbody end tag
\r
451 function yourls_table_tbody_end() {
\r
452 echo yourls_apply_filter( 'table_tbody_end', '</tbody>' );
\r
455 // Echo the table start tag
\r
456 function yourls_table_end() {
\r
457 echo yourls_apply_filter( 'table_end', '</table>' );
\r
460 // Echo HTML tag for a link
\r
461 function yourls_html_link( $href, $title = '', $element = '' ) {
\r
465 $element = "id='$element'";
\r
466 echo yourls_apply_filter( 'html_link', "<a href='$href' $element>$title</a>" );
\r
469 // Display the login screen. Nothing past this point.
\r
470 function yourls_login_screen( $error_msg = '' ) {
\r
471 yourls_html_head( 'login' );
\r
473 $action = ( isset($_GET['action']) && $_GET['action'] == 'logout' ? '?' : '' );
\r
475 yourls_html_logo();
\r
478 <form method="post" action="<?php echo $action; ?>"> <?php // reset any QUERY parameters ?>
\r
480 if(!empty($error_msg)) {
\r
481 echo '<p class="error">'.$error_msg.'</p>';
\r
485 <label for="username">Username</label><br />
\r
486 <input type="text" id="username" name="username" size="30" class="text" />
\r
489 <label for="password">Password</label><br />
\r
490 <input type="password" id="password" name="password" size="30" class="text" />
\r
492 <p style="text-align: right;">
\r
493 <input type="submit" id="submit" name="submit" value="Login" class="button" />
\r
496 <script type="text/javascript">$('#username').focus();</script>
\r
499 yourls_html_footer();
\r
503 // Display the admin menu
\r
504 function yourls_html_menu() {
\r
506 <ul id="admin_menu">
\r
507 <?php if ( yourls_is_private() ) { ?>
\r
508 <li>Hello <strong><?php echo YOURLS_USER; ?></strong> (<a href="?action=logout" title="Logout">Logout</a>)</li>
\r
510 <li><a href="<?php echo yourls_admin_url('index.php') ?>">Admin Interface</a></li>
\r
511 <?php if( yourls_is_admin() ) { ?>
\r
512 <li><a href="<?php echo yourls_admin_url('tools.php'); ?>">Tools</a></li>
\r
513 <li><a href="<?php echo yourls_admin_url('plugins.php'); ?>">Plugins</a></li>
\r
514 <?php yourls_list_plugin_admin_pages(); ?>
\r
515 <li><a href="<?php yourls_site_url(); ?>/readme.html">Help</a></li>
\r
516 <?php yourls_do_action( 'admin_menu' ); ?>
\r
520 yourls_do_action( 'admin_notices' );
\r
521 yourls_do_action( 'admin_notice' ); // because I never remember if it's 'notices' or 'notice'
\r
523 To display a notice:
\r
524 $message = "<div>OMG, dude, I mean!</div>" );
\r
525 yourls_add_action('admin_notices', create_function( '', "echo '$message';" ) );
\r
529 // Wrapper to admin notices
\r
530 function yourls_add_notice( $message ) {
\r
531 $message = yourls_notice_box( $message );
\r
532 yourls_add_action('admin_notices', create_function( '', "echo '$message';" ) );
\r
536 // Return a formatted notice
\r
537 function yourls_notice_box( $message ) {
\r
539 <div class="notice">
\r