1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
\r
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
\r
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
\r
5 <title>YOURLS: Your Own URL Shortener (and a WordPress plugin)</title>
\r
6 <style type="text/css" media="screen">
\r
9 font-family: Verdana, Arial;
\r
12 background: #ffffff;
\r
29 margin: 10px 20px 0px 20px;
\r
31 border: 1px solid #8d8d8d;
\r
32 background-color: #f5f5f5;
\r
40 a, a:active, a:link, a:visited {
\r
42 text-decoration: none;
\r
46 text-decoration: underline;
\r
52 border:1px solid #5b87b4;
\r
56 /* Place Holder Style */
\r
60 margin-right: auto;
\r
63 background-color: #fafafa;
\r
64 border: 1px solid #a2b6cb;
\r
70 font-family: Verdana, Arial;
\r
74 border-bottom: 1px solid #2a85b3;
\r
75 margin-bottom: 10px;
\r
76 background:transparent url(http://yourls.org/images/yourls-logo.png) top center no-repeat;
\r
83 font-family: Verdana, Arial;
\r
93 font-family: Verdana, Arial;
\r
105 font-family: Verdana, Arial;
\r
108 list-style-type: none;
\r
109 padding-bottom: 28px;
\r
110 border-bottom: 1px solid #a2b6cb;
\r
111 margin-bottom: 12px;
\r
117 background-color: #deedfb;
\r
118 margin: 2px 0px 0px 5px;
\r
119 border: 1px solid #a2b6cb;
\r
125 text-decoration: none;
\r
128 #Tabs li.Tab a:hover {
\r
129 background-color: #bfe0fe;
\r
130 border-bottom: 1px solid #bfe0fe;
\r
133 #Tabs li.SelectedTab {
\r
136 background-color: #fafafa;
\r
137 margin: 2px 0px 0px 5px;
\r
138 border-top: 1px solid #a2b6cb;
\r
139 border-right: 1px solid #a2b6cb;
\r
140 border-bottom: 1px solid #fafafa;
\r
141 border-left: 1px solid #a2b6cb;
\r
143 #Tabs li.SelectedTab a {
\r
147 text-decoration: none;
\r
153 text-align: center;
\r
158 <div id="Container">
\r
160 <h1>YOURLS: <span>Y</span>our <span>O</span>wn <span>URL</span> <span>S</span>hortener (and a WordPress plugin)</h1>
\r
164 <li id="FAQTab" class="Tab"><a href="#FAQ" onclick="toggle(this);">FAQ</a></li>
\r
165 <li id="APITab" class="Tab"><a href="#API" onclick="toggle(this);">API</a></li>
\r
166 <li id="PluginTab" class="Tab"><a href="#Plugin" onclick="toggle(this);">WordPress plugin</a></li>
\r
167 <li id="ConfigTab" class="Tab"><a href="#Config" onclick="toggle(this);">Configuration</a></li>
\r
168 <li id="InstallTab" class="Tab"><a href="#Install" onclick="toggle(this);">Installation</a></li>
\r
169 <li id="AboutTab" class="SelectedTab"><a href="#About" onclick="toggle(this);">About</a></li>
\r
175 <div id="AboutDiv">
\r
176 <h2>About YOURLS</h2>
\r
178 <h3>What is YOURLS</h3>
\r
179 <p>YOURLS is a small set of PHP scripts that will allow you to run your own URL shortening service (<em>a la</em> TinyURL). You can make it private or public, you can pick custom keyword URLs, it comes with its own API. You will love it.</p>
\r
180 <p>There's a <a href="#Plugin" onclick="toggle(this);">WordPress plugin</a> available for YOURLS, making integration with your blog a snap: create short URLs and tweet them automagically as you publish blog posts.</p>
\r
182 <h3>YOURLS Features</h3>
\r
184 <li>Public (everybody can create short links) or private (your links only)</li>
\r
185 <li>Random (sequential) or custom URL keyword</li>
\r
186 <li>Track click count on your links</li>
\r
187 <li>Neat AJAXed interface</li>
\r
188 <li>Developer API</li>
\r
191 <h3>Screenshots</h3>
\r
193 <div class="sshot">
\r
194 <img src="http://yourls.org/images/head.gif" />
\r
195 <img src="http://yourls.org/images/stats.gif" />
\r
196 <img src="http://yourls.org/images/footer.gif" />
\r
201 <p><a href="http://code.google.com/p/yourls/downloads/list">Download YOURLS</a> from Google Code</p>
\r
205 <p>YOURLS is made by:</p>
\r
207 <li><a href="http://lesterchan.net/" title="Visit Lester Chan's site">Lester Chan</a> &ndash <a href="http://twitter.com/gamerz">@GamerZ</a> on Twitter</li>
\r
208 <li><a href="http://planetozh.com/" title"Visit Ozh's site">Ozh RICHARD</a> &ndash <a href="http://twitter.com/ozh">@Ozh</a> on Twitter</li>
\r
212 <!-- Installation Instructions -->
\r
213 <div id="InstallDiv" style="display: none;">
\r
214 <h2>Installation Instructions</h2>
\r
216 <li>Unzip the YOURLS archive</li>
\r
217 <li>Copy <code>includes/config-sample.php</code> to <code>includes/config.php</code></li>
\r
218 <li>Open <code>includes/config.php</code> with a raw text editor (like Notepad) and fill in the required settings</li>
\r
219 <li>Upload the unzipped files to your domain <code>public_html</code> or <code>www</code> folder</li>
\r
220 <li>Create a new database (see <a href="#Config" onclick="toggle(this);">Configuration</a> – you can also use an existing one)</li>
\r
221 <li>Point your browser to <code>http://yoursite.com/admin/install.php</code></li>
\r
225 <!-- Configuration Instructions -->
\r
226 <div id="ConfigDiv" style="display: none;">
\r
227 <h2>Configuration (in includes/config.php)</h2>
\r
228 <h3>MySQL settings</h3>
\r
230 <li><code>YOURLS_DB_USER</code><br/>
\r
231 your MySQL username<br/>
\r
232 <em>Example:</em> <tt>'joe'</tt></li>
\r
233 <li><code>YOURLS_DB_PASS</code><br/>
\r
234 your MySQL password<br/>
\r
235 <em>Example:</em> <tt>'MySeCreTPaSsW0rd'</tt></li>
\r
236 <li><code>YOURLS_DB_NAME</code>:
\r
237 The database name<br/>
\r
238 <em>Example:</em> <tt>'yourls'</tt></li>
\r
239 <li><code>YOURLS_DB_HOST</code><br/>
\r
240 The database host<br/>
\r
241 <em>Example:</em> <tt>'localhost'</tt></li>
\r
242 <li><code>YOURLS_DB_TABLE_URL</code><br/>
\r
243 The table name to store URLs<br/>
\r
244 <em>Example:</em> <tt>'url'</tt></li>
\r
245 <li><code>YOURLS_DB_TABLE_NEXTDEC</code><br/>
\r
246 The table name to store the next sequential link decimal id<br/>
\r
247 <em>Example:</em> <tt>'nextdec'</tt></li>
\r
250 <h3>Site options</h3>
\r
252 <li><code>YOURLS_SITE</code><br/>
\r
253 Your (short) domain URL, no trailing slash<br/>
\r
254 <em>Example:</em> <tt>'http://ozh.in'</tt></li>
\r
255 <li><code>YOURLS_HOURS_OFFSET</code><br/>
\r
256 Timezone GMT offset<br/>
\r
257 <em>Example:</em> <tt>'-5'</tt></li>
\r
258 <li><code>YOURLS_PRIVATE</code><br/>
\r
259 Private means protected with login/pass as defined below. Set to false for public usage<br/>
\r
260 <em>Example:</em> <tt>'true'</tt></li>
\r
261 <li><code>YOURLS_COOKIEKEY</code><br/>
\r
262 A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: generate a unique one at <a href="http://yourls.org/cookiekey.php">http://yourls.org/cookiekey.php</a><br/>
\r
263 <em>Example:</em> <tt>'qQ4KhL_pu|s@Zm7n#%:b^{A[vhm'</tt></li>
\r
264 <li><code>yourls_user_passwords</code><br/>
\r
265 A list of username(s) and password(s) allowed to access the site if private<br/>
\r
266 <em>Example:</em> <tt>'joe' => 'mypassword'</tt></li>
\r
269 <h3>URL Shortening settings</h3>
\r
271 <li><code>YOURLS_URL_CONVERT</code><br/>
\r
272 URL shortening method: base <tt>36</tt> or <tt>62</tt>. See <a onclick="toggle(this);" href="#FAQ">FAQ</a> for more explanations</li>
\r
273 <li><code>yourls_reserved_URL</code><br/>
\r
274 A list of reserved keywords that won't be used as short URLs. Define here negative, unwanted or potentially misleading keywords<br/>
\r
275 <em>Example:</em> <tt>'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick', 'gay'</tt></li>
\r
279 <!-- WordPress plugin -->
\r
280 <div id="PluginDiv" style="display:none">
\r
281 <h2>WordPress Plugin</h2>
\r
285 <li>Generate short URLs for each new post or page</li>
\r
286 <li>Send a tweet on your Twitter account with the post title and short URL as you publish them</li>
\r
287 <li>Works if YOURLS is hosted on the same server or on a remote server</li>
\r
288 <li>Also compatible with tr.im, is.gd, tinyurl.com and bit.ly for maximum fun</li>
\r
291 <h3>Screenshots</h3>
\r
292 <div class="sshot">
\r
293 <img src="http://yourls.org/images/wpplugin.gif"/>
\r
296 <h3>Download & more informations</h3>
\r
298 <li>Download <a href="http://wordpress.org/extend/plugins/##">YOURLS: WordPress to Twitter</a> from the official WordPress plugin repository</li>
\r
299 <li>More information, tips and feedback on <a href="http://planetozh.com/####">the plugin page</a> from planetOzh</li>
\r
305 <div id="APIDiv" style="display:none">
\r
306 <h2>YOURLS' API</h2>
\r
310 <li>Generate or get existing short URLs, with sequential or custom keyword</li>
\r
311 <li>Get some statistics about your links: top clicked links, least clicked links, newest links</li>
\r
312 <li>Output format: JSON, XML, or simple raw text</li>
\r
316 <p>You need to send parameters to <code>http://yoursite.com/yourls-api.php</code> either via <code>GET</code> or <code>POST</code>. These parameters are:</p>
\r
318 <li>A valid <code>username</code></li>
\r
319 <li>A valid <code>password</code></li>
\r
320 <li>The requested <code>action</code>: either <tt>"shorturl"</tt> (get short URL for a link) or <tt>"stats"</tt> (get stats about your links)</li>
\r
321 <li>With <tt>action = "shorturl"</tt> :
\r
323 <li>the <code>url</code> to shorten</li>
\r
324 <li>optional <code>keyword</code> for custom short URLs</li>
\r
325 <li>output <code>format</code>: either <tt>"json"</tt>, <tt>"xml"</tt> or <tt>"simple"</tt></li>
\r
328 <li>With <tt>action = "stats"</tt> :
\r
330 <li>the <code>filter</code>: either <tt>"top"</tt>, <tt>"bottom"</tt> or <tt>"last"</tt></li>
\r
331 <li>the <code>limit</code> (maximum number of links to return)</li>
\r
332 <li>output <code>format</code>: either <tt>"json"</tt> or <tt>"xml"</tt></li>
\r
337 <h3>Sample return</h3>
\r
338 <pre><tt><result>
\r
340 <id>62019439011</id>
\r
341 <keyword>shorter</keyword>
\r
342 <url>http://somereallylongurlyouneedtoshrink.com/</url>
\r
343 <date>2009-06-23 18:08:07</date>
\r
344 <ip>127.0.0.1</ip>
\r
346 <status>success</status>
\r
347 <message>http://somereallylongurlyouneedtoshrink.com/ (ID: shorter) added to database</message>
\r
348 <shorturl>http://yoursite.com/shorter</shorturl>
\r
349 </result></tt></pre>
\r
351 <h3>Sample file</h3>
\r
352 <p>There's a sample file included that serves as an example on how to play with the API</p>
\r
357 <!-- FAQ Instructions -->
\r
358 <div id="FAQDiv" style="display: none;">
\r
361 <h3>Server requirements</h3>
\r
363 <li>At least <strong>PHP 4.3</strong></li>
\r
364 <li>At least <strong>MYSQL 4.1</strong></li>
\r
367 <h3>Server recommendations</h3>
\r
369 <li>PHP <a href="http://www.php.net/curl">CURL extension</a> installed if you plan on playing with the API</li>
\r
370 <li>PHP <a href="http://www.php.net/bccomp">BCCOMP extension</a> for handling large integers (ie many (really many many) links or long custom keyword URLs)</li>
\r
373 <h3>Limitations</h3>
\r
375 <li>Maximum length of custom keyword is <strong>12 characters</strong></li>
\r
376 <li><strong>4,738,381,338,321,617,846</strong> available URLs</li>
\r
379 <h3>Difference Between Base 36 And Base 62 Encoding</h3>
\r
381 <li>Base 36 encoding uses <code>0123456789abcdefghijklmnopqrstuvwxyz</code></li>
\r
382 <li>Base 62 encoding uses <code>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</code></li>
\r
383 <li>Stick to one setting, don't change after you've created links as it will change all your short URLs!</li>
\r
384 <li>Base 36 should be picked. Use 62 only if you understand what it implies.</li>
\r
385 <li>Using base 62 means you *need* PHP extension BCCOMP</li>
\r
388 <h3>Getting a short domain name for your YOURLS install</h3>
\r
390 <li>Unless you plan on making it public, any shared hosting should be fine</li>
\r
391 <li><a href="http://domai.nr/">Domainr</a> is a fun search tool that might inspire and help you</li>
\r
392 <li>Aim for exotic top level domains (.in, .im, .li ...), they're often cheap and a lot are still available. <a href="https://www.gandi.net/domain/buy/search/">Gandi</a> is a pretty comprehensive registrar, for instance.</li>
\r
397 <p id="Copyright">YOURLS: Your Own URL Shortener<br />All Free & GPL – 2009</p>
\r
399 <script type="text/javascript">
\r
401 // Dynamically get tabs
\r
402 function getTabs() {
\r
403 var d = document.getElementById('Tabs');
\r
404 var matches = d.innerHTML.match(/<li id="(.+?)Tab"/g);
\r
406 for (i in matches) {
\r
407 tabs[i]= matches[i].replace('<li id="','').replace('Tab"', '');
\r
409 tabs = tabs.reverse();
\r
412 // Toggle tab display
\r
413 function toggle(el) {
\r
414 //var tabs = ["About", "Install", "Config", "Plugin", "FAQ"];
\r
415 var target = el.toString().replace(/^.*#/, '');
\r
416 for (var tab in tabs) {
\r
418 document.getElementById(tabs[tab]+'Tab').className = 'Tab';
\r
420 document.getElementById(tabs[tab]+'Div').style.display= 'none';
\r
422 // highlight & display target
\r
423 document.getElementById(target+'Div').style.display = 'block';
\r
424 document.getElementById(target+'Tab').className = 'SelectedTab';
\r
428 var tabs = getTabs();
\r
429 // On page load/refresh display required tab
\r
430 if (location.hash) {
\r
431 toggle(location.hash);
\r