]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - sample-public-front-page.php.txt
Move tablesorting stuff to the proper JS file
[Github/YOURLS.git] / sample-public-front-page.php.txt
1 <?php \r
2 // Start YOURLS engine\r
3 require_once( dirname(__FILE__).'/includes/load-yourls.php' );\r
4 \r
5 ?>\r
6 <html>\r
7 <head>\r
8 <title>YOURLS Public Interface Sample</title>\r
9 <style>\r
10 body {\r
11         background:#F3FAFD;\r
12         color:#5B87B4;\r
13         font:16px/30px verdana,arial,sans-serif;\r
14 }\r
15 h1 {text-align:center}\r
16 h2 {border-bottom:1px solid white;}\r
17 #container {\r
18         width: 780px;\r
19         margin-left: auto;\r
20         margin-right: auto; \r
21         background-color: #fff;\r
22         border: 2px solid #2A85B3;\r
23         padding: 10px;\r
24         margin-top: -13px;\r
25         -moz-border-radius:15px;\r
26         -webkit-border-radius:15px;\r
27 }\r
28 #footer {\r
29         text-align:center;\r
30         margin-top:20px;\r
31 }\r
32 #footer p {\r
33         padding:5px;\r
34         background:white;\r
35         margin:0 auto;\r
36         width:750px;\r
37         -moz-border-radius:10px;\r
38         -webkit-border-radius:10px;\r
39         border:1px solid #2A85B3;\r
40         -moz-border-radius-bottomleft:35px;\r
41         -moz-border-radius-bottomright:35px;\r
42         -webkit-border-bottom-left-radius:25px;\r
43         -webkit-border-bottom-right-radius:25px;\r
44 }\r
45 #footer p a {\r
46         background:#fff url(http://yourls.org/images/favicon.gif) 2px center no-repeat;\r
47         padding-left:20px;\r
48 }\r
49 div#copybox { width:600px}\r
50 div#sharebox {height:auto; width:600px; margin-top: 20px}\r
51 </style>\r
52 <link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />\r
53 <script src="<?php echo YOURLS_SITE; ?>/js/jquery-1.3.2.min.js" type="text/javascript"></script>\r
54 <script src="<?php echo YOURLS_SITE; ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>\r
55 </head>\r
56 \r
57 <body>\r
58 <h1>YOURLS: Your Own URL Shortener</h1>\r
59 \r
60 <div id="container">\r
61 \r
62         <?php\r
63 \r
64         // Part to be executed if FORM has been submitted\r
65         if ( isset($_REQUEST['url']) ) {\r
66 \r
67                 $url = $_REQUEST['url'];\r
68                 $keyword = isset( $_REQUEST['keyword'] ) ? $_REQUEST['keyword'] : '' ;\r
69 \r
70                 $return = yourls_add_new_link( $url, $keyword );\r
71                 \r
72                 $shorturl = $return['shorturl'];\r
73                 $message = $return['message'];\r
74                 \r
75                 echo <<<RESULT\r
76                 <h2>URL has been shortened</h2>\r
77                 <p>Original URL: <code><a href="$url">$url</a></code></p>\r
78                 <p>Short URL: <code><a href="$shorturl">$shorturl</a></code></p>\r
79                 <p>$message</p>\r
80 RESULT;\r
81                 \r
82                 // Include the Copy box and the Quick Share box\r
83                 yourls_share_box( $url, $shorturl );\r
84 \r
85         // Part to be executed when no form has been submitted\r
86         } else {\r
87 \r
88                 echo <<<HTML\r
89                 <h2>Enter a new URL to shorten</h2>\r
90                 <form method="post" action="">\r
91                 <p><label>URL: <input type="text" name="url" value="http://" size="50" /></label></p>\r
92                 <p><label>Optional custom keyword: <input type="text" name="keyword" size="5" /></label></p>\r
93                 <p><input type="submit" value="Shorten" /></p>\r
94                 </form> \r
95 HTML;\r
96 \r
97         }\r
98 \r
99         ?>\r
100 \r
101         <!-- Example bookmarklet. Be sure to rename the link target from "sample-public-front-page.php" to whatever you'll use (probably index.php) -->\r
102         <p><a href="javascript:void(location.href='<?php echo YOURLS_SITE; ?>/sample-public-front-page.php?format=simple&action=shorturl&url='+escape(location.href))">bookmarklet</a>\r
103 \r
104 </div>\r
105 \r
106 <div id="footer"><p>Powered by <a href="http://yourls.org/" title="YOURLS">YOURLS</a> v<?php echo YOURLS_VERSION; ?></p></div>\r
107 </body>\r
108 </html>