2 define( 'YOURLS_ADMIN', true );
\r
3 require_once( dirname(dirname(__FILE__)).'/includes/load-yourls.php' );
\r
4 yourls_maybe_require_auth();
\r
6 yourls_html_head( 'tools' );
\r
11 <div class="sub_wrap">
\r
13 <h2>Bookmarklets</h2>
\r
15 <p>YOURLS comes with two handy <span>bookmarklets</span> for easier link shortening.</p>
\r
17 <li>The simple one generates a short URL from the page you are currently viewing.</li>
\r
18 <li>The second one does the same but first asks for a <span>custom URL keyword</span> – if you enter none a random one will be picked.</li>
\r
21 <p>The bookmarklets will take you to a page where you can easily <span>edit</span> or <span>delete</span> your brand new short URL.</p>
\r
23 <p>There is also a <span>Quick Share</span> tool box to make posting to Twitter, Facebook or Friendfeed a snap.</p>
\r
25 <p>If you want to share a description along with the link you're shortening, simply <span>select text</span> on the page you're viewing before clicking on your bookmarklet link</p>
\r
28 <li><h3>Simple bookmarklet</h3>
\r
29 Click and drag the link to your toolbar: <a href="javascript:var%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:enc(s)),f='<?php echo yourls_admin_url('index.php'); ?>',l=d.location,p='?u='+enc(l.href)+'&t='+enc(d.title)+'&s='+s2,u=f+p;try%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0);" class="bookmarklet" onclick="alert('Drag to your toolbar!');return false;">Shorten</a>
\r
32 <li><h3>Advanced bookmarklet (custom keyword)</h3>
\r
33 Click and drag the link to your toolbar: <a href="javascript:var%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:('%22'+enc(s)+'%22')),f='<?php echo yourls_admin_url('index.php'); ?>',l=d.location,k=prompt(%22Custom%20URL%22),k2=(k?'&k='+k:%22%22),p='?u='+enc(l.href)+'&t='+enc(d.title)+''+s2+k2,u=f+p;try%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0)" class="bookmarklet" onclick="alert('Drag to your toolbar!');return false;">Custom shorten</a>
\r
39 <?php if( yourls_is_private() ) { ?>
\r
41 <div class="sub_wrap">
\r
43 <h2>Secure passwordless API call</h2>
\r
45 <p>YOURLS allows API calls the old fashioned way, using <tt>username</tt> and <tt>password</tt>
\r
46 parameters. If you're worried about sending your credentials into the wild, you can also make API
\r
47 calls without using your login or your password, using a secret signature token.</p>
\r
49 <p>Your secret signature token: <strong><code><?php echo yourls_auth_signature(); ?></code></strong>
\r
50 (It's a secret. Keep it secret)</p>
\r
52 <p>This signature token can only be used with the API, not with the admin interface.</p>
\r
55 <li><h3>Usage of the signature token</h3>
\r
56 <p>Simply use parameter <tt>signature</tt> in your API requests. Example:</p>
\r
57 <p><code><?php echo YOURLS_SITE; ?>/yourls-api.php?signature=<?php echo yourls_auth_signature(); ?>&action=...</code></p>
\r
60 <li><h3>Usage of a time limited signature token</h3>
\r
62 $timestamp = time();
\r
63 <tt>// actual value: $time = <?php $time = time(); echo $time; ?></tt>
\r
64 $signature = md5( $timestamp . '<?php echo yourls_auth_signature(); ?>' );
\r
65 <tt>// actual value: $signature = "<?php $sign = md5( $time. yourls_auth_signature() ); echo $sign; ?>"</tt>
\r
68 <p>Now use parameters <tt>signature</tt> and <tt>timestamp</tt> in your API requests. Example:</p>
\r
69 <p><code><?php echo YOURLS_SITE; ?>/yourls-api.php?timestamp=<strong>$timestamp</strong>&signature=<strong>$signature</strong>&action=...</code></p>
\r
70 <p>Actual values:<br/>
\r
71 <tt><?php echo YOURLS_SITE; ?>/yourls-api.php?timestamp=<?php echo $time; ?>&signature=<?php echo $sign; ?>&action=...</tt></p>
\r
72 <p>This URL would be valid for only <?php echo YOURLS_NONCE_LIFE; ?> seconds</p>
\r
76 <p>(See the <a href="<?php echo YOURLS_SITE; ?>/readme.html#API">API documentation</a> for more)</p>
\r
80 <?php } // end is private ?>
\r
82 <?php yourls_html_footer(); ?>