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
18 yourls_do_action( 'pre_html_head', $context, $title );
\r
20 // All components to false, except when specified true
\r
21 $share = $insert = $tablesorter = $tabs = $cal = false;
\r
23 // Load components as needed
\r
24 switch ( $context ) {
\r
26 $share = $tabs = true;
\r
30 $share = $insert = $tablesorter = true;
\r
34 $insert = $tablesorter = $cal = $share = true;
\r
39 $tablesorter = true;
\r
49 // Force no cache for all admin pages
\r
50 if( yourls_is_admin() && !headers_sent() ) {
\r
51 header( 'Expires: Thu, 23 Mar 1972 07:00:00 GMT' );
\r
52 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
\r
53 header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
\r
54 header( 'Pragma: no-cache' );
\r
55 yourls_do_action( 'admin_headers', $context, $title );
\r
58 // Store page context in global object
\r
60 $ydb->context = $context;
\r
63 $bodyclass = yourls_apply_filter( 'bodyclass', '' );
\r
64 $bodyclass .= ( yourls_is_mobile_device() ? 'mobile' : 'desktop' );
\r
67 $_title = 'YOURLS — Your Own URL Shortener | ' . yourls_link();
\r
68 $title = $title ? $title . " « " . $_title : $_title;
\r
69 $title = yourls_apply_filter( 'html_title', $title, $context );
\r
72 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\r
73 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
\r
75 <title><?php echo $title ?></title>
\r
76 <link rel="icon" type="image/gif" href="<?php yourls_site_url(); ?>/images/favicon.gif" />
\r
77 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
78 <meta http-equiv="X-UA-Compatible" content="chrome=1" />
\r
79 <meta name="author" content="Ozh RICHARD & Lester CHAN for http://yourls.org/" />
\r
80 <meta name="generator" content="YOURLS <?php echo YOURLS_VERSION ?>" />
\r
81 <meta name="description" content="Insert URL « YOURLS » Your Own URL Shortener' | <?php yourls_site_url(); ?>" />
\r
82 <script src="<?php yourls_site_url(); ?>/js/jquery-1.6.1.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
83 <script src="<?php yourls_site_url(); ?>/js/common.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
84 <script src="<?php yourls_site_url(); ?>/js/jquery.notifybar.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
85 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/style.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
86 <?php if ($tabs) { ?>
\r
87 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/infos.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
88 <script src="<?php yourls_site_url(); ?>/js/infos.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
90 <?php if ($tablesorter) { ?>
\r
91 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/tablesorter.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
92 <script src="<?php yourls_site_url(); ?>/js/jquery.tablesorter.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
94 <?php if ($insert) { ?>
\r
95 <script src="<?php yourls_site_url(); ?>/js/insert.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
97 <?php if ($share) { ?>
\r
98 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
99 <script src="<?php yourls_site_url(); ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
100 <script src="<?php yourls_site_url(); ?>/js/ZeroClipboard.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
101 <script type="text/javascript">ZeroClipboard.setMoviePath( '<?php yourls_site_url(); ?>/js/ZeroClipboard.swf' );</script>
\r
103 <?php if ($cal) { ?>
\r
104 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/cal.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
\r
105 <script src="<?php yourls_site_url(); ?>/js/jquery.cal.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
\r
107 <script type="text/javascript">
\r
109 var ajaxurl = '<?php echo yourls_admin_url( 'admin-ajax.php' ); ?>';
\r
112 <?php yourls_do_action( 'html_head', $context ); ?>
\r
114 <body class="<?php echo $context; ?> <?php echo $bodyclass; ?>">
\r
119 // Display HTML footer (including closing body & html tags)
\r
120 function yourls_html_footer() {
\r
123 $num_queries = $ydb->num_queries > 1 ? $ydb->num_queries.' queries' : $ydb->num_queries.' query';
\r
125 </div> <?php // wrap ?>
\r
126 <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
127 <?php if( defined('YOURLS_DEBUG') && YOURLS_DEBUG == true ) {
\r
128 echo '<p>'. $ydb->all_queries .'<p>';
\r
130 <?php yourls_do_action( 'html_footer', $ydb->context ); ?>
\r
136 // Display "Add new URL" box
\r
137 function yourls_html_addnew( $url = '', $keyword = '' ) {
\r
138 $url = $url ? $url : 'http://';
\r
142 <form id="new_url_form" action="" method="get">
\r
143 <div><strong>Enter the URL</strong>:<input type="text" id="add-url" name="url" value="<?php echo $url; ?>" class="text" size="80" />
\r
144 Optional: <strong>Custom short URL</strong>:<input type="text" id="add-keyword" name="keyword" value="<?php echo $keyword; ?>" class="text" size="8" />
\r
145 <?php yourls_nonce_field( 'add_url', 'nonce-add' ); ?>
\r
146 <input type="button" id="add-button" name="add-button" value="Shorten The URL" class="button" onclick="add();" /></div>
\r
148 <div id="feedback" style="display:none"></div>
\r
150 <?php yourls_do_action( 'html_addnew' ); ?>
\r
155 // Display main table's footer
\r
156 function yourls_html_tfooter( $params = array() ) {
\r
157 extract( $params ); // extract $search_text, $page, $search_in_sql ...
\r
162 <th colspan="4" style="text-align: left;">
\r
163 <form action="" method="get">
\r
165 Search for
\r
166 <input type="text" name="s_search" class="text" size="20" value="<?php echo $search_text; ?>" />
\r
168 <select name="s_in" size="1">
\r
169 <option value="keyword"<?php if($search_in_sql == 'keyword') { echo ' selected="selected"'; } ?>>Short URL</option>
\r
170 <option value="url"<?php if($search_in_sql == 'url') { echo ' selected="selected"'; } ?>>URL</option>
\r
171 <option value="title"<?php if($search_in_sql == 'title') { echo ' selected="selected"'; } ?>>Title</option>
\r
172 <option value="ip"<?php if($search_in_sql == 'ip') { echo ' selected="selected"'; } ?>>IP</option>
\r
174 – Order by
\r
175 <select name="s_by" size="1">
\r
176 <option value="id"<?php if($sort_by_sql == 'keyword') { echo ' selected="selected"'; } ?>>Short URL</option>
\r
177 <option value="url"<?php if($sort_by_sql == 'url') { echo ' selected="selected"'; } ?>>URL</option>
\r
178 <option value="timestamp"<?php if($sort_by_sql == 'timestamp') { echo ' selected="selected"'; } ?>>Date</option>
\r
179 <option value="ip"<?php if($sort_by_sql == 'ip') { echo ' selected="selected"'; } ?>>IP</option>
\r
180 <option value="clicks"<?php if($sort_by_sql == 'clicks') { echo ' selected="selected"'; } ?>>Clicks</option>
\r
182 <select name="s_order" size="1">
\r
183 <option value="asc"<?php if($sort_order_sql == 'asc') { echo ' selected="selected"'; } ?>>Ascending</option>
\r
184 <option value="desc"<?php if($sort_order_sql == 'desc') { echo ' selected="selected"'; } ?>>Descending</option>
\r
186 – Show
\r
187 <input type="text" name="perpage" class="text" size="2" value="<?php echo $perpage; ?>" /> rows<br/>
\r
190 <select name="link_filter" size="1">
\r
191 <option value="more"<?php if($link_filter === 'more') { echo ' selected="selected"'; } ?>>more</option>
\r
192 <option value="less"<?php if($link_filter === 'less') { echo ' selected="selected"'; } ?>>less</option>
\r
195 <input type="text" name="link_limit" class="text" size="4" value="<?php echo $link_limit; ?>" />clicks<br/>
\r
198 <select name="date_filter" id="date_filter" size="1">
\r
199 <option value="before"<?php if($date_filter === 'before') { echo ' selected="selected"'; } ?>>before</option>
\r
200 <option value="after"<?php if($date_filter === 'after') { echo ' selected="selected"'; } ?>>after</option>
\r
201 <option value="between"<?php if($date_filter === 'between') { echo ' selected="selected"'; } ?>> between</option>
\r
203 <input type="text" name="date_first" id="date_first" class="text" size="12" value="<?php echo $date_first; ?>" />
\r
204 <span id="date_and" <?php if($date_filter === 'between') { echo ' style="display:inline"'; } ?>> and </span>
\r
205 <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
207 <div style="float:right;">
\r
208 <input type="submit" id="submit-sort" value="Filter" class="button primary" />
\r
210 <input type="button" id="submit-clear-filter" value="Clear Filter" class="button" onclick="window.parent.location.href = 'index.php'" />
\r
217 <th colspan="3" style="text-align: right;">
\r
218 Pages (<?php echo $total_pages; ?>):
\r
221 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
224 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
226 for($i = $page - 2 ; $i <= $page +2; $i++) {
\r
227 if ($i >= 1 && $i <= $total_pages) {
\r
229 echo "<strong>[$i]</strong> ";
\r
231 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
235 if($page < $total_pages) {
\r
236 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
238 if (($page+2) < $total_pages) {
\r
239 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
244 <?php yourls_do_action( 'html_tfooter' ); ?>
\r
249 // Display the Quick Share box
\r
250 function yourls_share_box( $longurl, $shorturl, $title='', $text='', $shortlink_title = '<h2>Your short link</h2>', $share_title = '<h2>Quick Share</h2>', $hidden = false ) {
\r
251 // Allow plugins to short-circuit the whole function
\r
252 $pre = yourls_apply_filter( 'shunt_share_box', false );
\r
253 if ( false !== $pre )
\r
256 $text = ( $text ? '"'.$text.'" ' : '' );
\r
257 $title = ( $title ? "$title " : '' );
\r
258 $share = htmlspecialchars_decode( $title.$text.$shorturl );
\r
259 $count = 140 - strlen( $share );
\r
260 $hidden = ( $hidden ? 'style="display:none;"' : '' );
\r
262 // Allow plugins to filter all data
\r
263 $data = compact( 'longurl', 'shorturl', 'title', 'text', 'shortlink_title', 'share_title', 'share', 'count', 'hidden' );
\r
264 $data = yourls_apply_filter( 'share_box_data', $data );
\r
267 $_share = rawurlencode( $share );
\r
268 $_url = rawurlencode( $shorturl );
\r
271 <div id="shareboxes" <?php echo $hidden; ?>>
\r
273 <?php yourls_do_action( 'shareboxes_before', $longurl, $shorturl, $title, $text ); ?>
\r
275 <div id="copybox" class="share">
\r
276 <?php echo $shortlink_title; ?>
\r
277 <p><input id="copylink" class="text" size="40" value="<?php echo $shorturl; ?>" /></p>
\r
278 <p><small>Long link: <a id="origlink" href="<?php echo $longurl; ?>"><?php echo $longurl; ?></a></small>
\r
279 <?php if( yourls_do_log_redirect() ) { ?>
\r
280 <br/><small>Stats: <a id="statlink" href="<?php echo $shorturl; ?>+"><?php echo $shorturl; ?>+</a></small>
\r
281 <input type="hidden" id="titlelink" value="<?php echo $title; ?>" />
\r
286 <?php yourls_do_action( 'shareboxes_middle', $longurl, $shorturl, $title, $text ); ?>
\r
288 <div id="sharebox" class="share">
\r
289 <?php echo $share_title; ?>
\r
291 <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span>
\r
292 <textarea id="tweet_body"><?php echo $share; ?></textarea>
\r
294 <p id="share_links">Share with
\r
295 <a id="share_tw" href="http://twitter.com/home?status=<?php echo $_share; ?>" title="Tweet this!" onclick="share('tw');return false">Twitter</a>
\r
296 <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
297 <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
299 yourls_do_action( 'share_links', $longurl, $shorturl, $title, $text );
\r
300 // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn.
\r
305 <?php yourls_do_action( 'shareboxes_after', $longurl, $shorturl, $title, $text ); ?>
\r
314 function yourls_die( $message = '', $title = '', $header_code = 200 ) {
\r
315 yourls_status_header( $header_code );
\r
317 yourls_html_head();
\r
318 yourls_html_logo();
\r
319 echo yourls_apply_filter( 'die_title', "<h2>$title</h2>" );
\r
320 echo yourls_apply_filter( 'die_message', "<p>$message</p>" );
\r
321 yourls_do_action( 'yourls_die' );
\r
322 yourls_html_footer();
\r
326 // Add the "Edit" row
\r
327 function yourls_table_edit_row( $keyword ) {
\r
330 $table = YOURLS_DB_TABLE_URL;
\r
331 $keyword = yourls_sanitize_string( $keyword );
\r
332 $id = yourls_string2htmlid( $keyword ); // used as HTML #id
\r
333 $url = yourls_get_keyword_longurl( $keyword );
\r
334 $title = htmlspecialchars( yourls_get_keyword_title( $keyword ) );
\r
335 $safe_url = stripslashes( $url );
\r
336 $safe_title = stripslashes( $title );
\r
337 $www = yourls_link();
\r
339 $save_link = yourls_nonce_url( 'save-link_'.$id,
\r
340 yourls_add_query_arg( array( 'id' => $id, 'action' => 'edit_save', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
343 $nonce = yourls_create_nonce( 'edit-save_'.$id );
\r
346 $return = <<<RETURN
\r
347 <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
350 $return = '<tr><td colspan="6">Error, URL not found</td></tr>';
\r
353 $return = yourls_apply_filter( 'table_edit_row', $return, $keyword, $url, $title );
\r
359 function yourls_table_add_row( $keyword, $url, $title = '', $ip, $clicks, $timestamp ) {
\r
360 $keyword = yourls_sanitize_string( $keyword );
\r
361 $display_keyword = htmlentities( $keyword );
\r
363 $url = yourls_sanitize_url( $url );
\r
364 $display_url = htmlentities( yourls_trim_long_string( $url ) );
\r
365 $title_url = htmlspecialchars( $url );
\r
367 $title = yourls_sanitize_title( $title ) ;
\r
368 $display_title = yourls_trim_long_string( $title );
\r
369 $title = htmlspecialchars( $title );
\r
371 $id = yourls_string2htmlid( $keyword ); // used as HTML #id
\r
372 $date = date( 'M d, Y H:i', $timestamp+( YOURLS_HOURS_OFFSET * 3600 ) );
\r
373 $clicks = number_format( $clicks, 0, '', '' );
\r
375 $shorturl = yourls_link( $keyword );
\r
376 $statlink = yourls_statlink( $keyword );
\r
377 if( yourls_is_ssl() )
\r
378 $statlink = str_replace( 'http://', 'https://', $statlink );
\r
381 $display_link = "<a href=\"$url\" title=\"$title\">$display_title</a><br/><small><a href=\"$url\" title=\"$title_url\">$display_url</a></small>";
\r
383 $display_link = "<a href=\"$url\" title=\"$title_url\">$display_url</a>";
\r
386 $delete_link = yourls_nonce_url( 'delete-link_'.$id,
\r
387 yourls_add_query_arg( array( 'id' => $id, 'action' => 'delete', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
390 $edit_link = yourls_nonce_url( 'edit-link_'.$id,
\r
391 yourls_add_query_arg( array( 'id' => $id, 'action' => 'edit', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) )
\r
394 // Action button links
\r
397 'href' => $statlink,
\r
398 'id' => "statlink-$id",
\r
399 'title' => 'Stats',
\r
400 'anchor' => 'Stats',
\r
404 'id' => "share-button-$id",
\r
405 'title' => 'Share',
\r
406 'anchor' => 'Share',
\r
407 'onclick' => "toggle_share('$id');return false;",
\r
410 'href' => $edit_link,
\r
411 'id' => "edit-button-$id",
\r
413 'anchor' => 'Edit',
\r
414 'onclick' => "edit('$id');return false;",
\r
417 'href' => $delete_link,
\r
418 'id' => "delete-button-$id",
\r
419 'title' => 'Delete',
\r
420 'anchor' => 'Delete',
\r
421 'onclick' => "remove('$id');return false;",
\r
424 $actions = yourls_apply_filter( 'table_add_row_action_array', $actions );
\r
425 $action_links = '';
\r
426 foreach( $actions as $key => $action ) {
\r
427 $onclick = isset( $action['onclick'] ) ? 'onclick="' . $action['onclick'] . '"' : '' ;
\r
428 $action_links .= sprintf( '<a href="%s" id="%s" title="%s" class="%s" %s>%s</a>',
\r
429 $action['href'], $action['id'], $action['title'], 'button button_'.$key, $onclick, $action['anchor']
\r
432 $action_links = yourls_apply_filter( 'action_links', $action_links, $keyword, $url, $ip, $clicks, $timestamp );
\r
435 <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
437 $row = yourls_apply_filter( 'table_add_row', $row, $keyword, $url, $title, $ip, $clicks, $timestamp );
\r
442 // Echo the main table head
\r
443 function yourls_table_head() {
\r
444 $start = '<table id="main_table" class="tblSorter" cellpadding="0" cellspacing="1"><thead><tr>'."\n";
\r
445 echo yourls_apply_filter( 'table_head_start', $start );
\r
447 $cells = yourls_apply_filter( 'table_head_cells', array(
\r
448 'shorturl' => 'Short URL ',
\r
449 'longurl' => 'Original URL',
\r
452 'clicks' => 'Clicks ',
\r
453 'actions' => 'Actions'
\r
455 foreach( $cells as $k => $v ) {
\r
456 echo "<th id='main_table_head_$k'>$v</th>\n";
\r
459 $end = "</tr></thead>\n";
\r
460 echo yourls_apply_filter( 'table_head_end', $end );
\r
463 // Echo the tbody start tag
\r
464 function yourls_table_tbody_start() {
\r
465 echo yourls_apply_filter( 'table_tbody_start', '<tbody>' );
\r
468 // Echo the tbody end tag
\r
469 function yourls_table_tbody_end() {
\r
470 echo yourls_apply_filter( 'table_tbody_end', '</tbody>' );
\r
473 // Echo the table start tag
\r
474 function yourls_table_end() {
\r
475 echo yourls_apply_filter( 'table_end', '</table>' );
\r
478 // Echo HTML tag for a link
\r
479 function yourls_html_link( $href, $title = '', $element = '' ) {
\r
483 $element = "id='$element'";
\r
484 echo yourls_apply_filter( 'html_link', "<a href='$href' $element>$title</a>" );
\r
487 // Display the login screen. Nothing past this point.
\r
488 function yourls_login_screen( $error_msg = '' ) {
\r
489 yourls_html_head( 'login' );
\r
491 $action = ( isset($_GET['action']) && $_GET['action'] == 'logout' ? '?' : '' );
\r
493 yourls_html_logo();
\r
496 <form method="post" action="<?php echo $action; ?>"> <?php // reset any QUERY parameters ?>
\r
498 if(!empty($error_msg)) {
\r
499 echo '<p class="error">'.$error_msg.'</p>';
\r
503 <label for="username">Username</label><br />
\r
504 <input type="text" id="username" name="username" size="30" class="text" />
\r
507 <label for="password">Password</label><br />
\r
508 <input type="password" id="password" name="password" size="30" class="text" />
\r
510 <p style="text-align: right;">
\r
511 <input type="submit" id="submit" name="submit" value="Login" class="button" />
\r
514 <script type="text/javascript">$('#username').focus();</script>
\r
517 yourls_html_footer();
\r
521 // Display the admin menu
\r
522 function yourls_html_menu() {
\r
524 <ul id="admin_menu">
\r
525 <?php if ( yourls_is_private() ) { ?>
\r
526 <li>Hello <strong><?php echo YOURLS_USER; ?></strong> (<a href="?action=logout" title="Logout">Logout</a>)</li>
\r
528 <li><a href="<?php echo yourls_admin_url('index.php') ?>">Admin Interface</a></li>
\r
529 <?php if( yourls_is_admin() ) { ?>
\r
530 <li><a href="<?php echo yourls_admin_url('tools.php'); ?>">Tools</a></li>
\r
531 <li><a href="<?php echo yourls_admin_url('plugins.php'); ?>">Plugins</a></li>
\r
532 <?php yourls_list_plugin_admin_pages(); ?>
\r
533 <li><a href="<?php yourls_site_url(); ?>/readme.html">Help</a></li>
\r
534 <?php yourls_do_action( 'admin_menu' ); ?>
\r
538 yourls_do_action( 'admin_notices' );
\r
539 yourls_do_action( 'admin_notice' ); // because I never remember if it's 'notices' or 'notice'
\r
541 To display a notice:
\r
542 $message = "<div>OMG, dude, I mean!</div>" );
\r
543 yourls_add_action('admin_notices', create_function( '', "echo '$message';" ) );
\r
547 // Wrapper to admin notices
\r
548 function yourls_add_notice( $message ) {
\r
549 $message = yourls_notice_box( $message );
\r
550 yourls_add_action('admin_notices', create_function( '', "echo '$message';" ) );
\r
554 // Return a formatted notice
\r
555 function yourls_notice_box( $message ) {
\r
557 <div class="notice">
\r