markup and all CSS & JS files yourls_html_head(); yourls_template_content( 'before', 'index' ); // Display title yourls_html_htag( 'YOURLS', 1, 'Your Own URL Shortener' ); // Part to be executed if FORM has been submitted if ( isset( $_REQUEST['url'] ) && $_REQUEST['url'] != 'http://' ) { // Display result message of short link creation if( isset( $message ) ) { yourls_html_htag( $message, 2 ); } if( $status == 'success' ) { // Include the Copy box and the Quick Share box yourls_share_box( $url, $shorturl, $title, $text ); } // Part to be executed when no form has been submitted } else { $site = YOURLS_SITE; yourls_html_htag( 'Enter a new URL to shorten', 2 ); // Display the form echo '
' . $site . '/
'; } yourls_html_htag( 'Bookmarklets', 2 ); echo '
'; $bookmarks = array ( 'simple' => array ( 'name' => yourls__( 'Default + Standard' ), 'type' => array( 'default', 'standard' ), 'link' => "javascript:(function()%7Bvar%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='" . 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);%7D)()", ), 'custom' => array ( 'name' => yourls__( 'Custom + Standard' ), 'type' => array( 'standard', 'custom' ), 'link' => "javascript:(function()%7Bvar%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='" . 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)+'&s='+s2+k2,u=f+p;if(k!=null)%7Btry%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)%7D%7D)()", ), 'simple-pop' => array ( 'name' => yourls__( 'Default + Popup' ), 'type' => array( 'default', 'popup' ), 'link' => "javascript:(function()%7Bvar%20d=document,s=d.createElement('script');window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='" . yourls_admin_url( 'index.php' ) . "?u='+encodeURIComponent(d.location.href)+'&jsonp=yourls';void(d.body.appendChild(s));%7D)();", ), 'custom-pop' => array ( 'name' => yourls__( 'Custom + Popup' ), 'type' => array( 'popup', 'custom' ), 'link' => "javascript:(function()%7Bvar%20d=document,k=prompt('Custom%20URL'),s=d.createElement('script');if(k!=null){window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='" . yourls_admin_url( 'index.php' ) . "?u='+encodeURIComponent(d.location.href)+'&k='+k+'&jsonp=yourls';void(d.body.appendChild(s));%7D%7D)();", ), ); $bookmarks = yourls_apply_filter( 'classic_bookmarklet_data', $bookmarks ); foreach( $bookmarks as $bookmark ) { echo '
'; echo '
' . $bookmark['name'] . '
'; echo ''; echo '
'; } echo '
'; $bookmarks = array ( // Bookmarklets, unformatted for readability: https://gist.github.com/ozh/5495656 'facebook' => array ( 'name' => yourls__( 'YOURLS & Facebook' ), 'color' => 'info', 'description' => yourls__( 'Create a short URL and share it on social networks, all in one click!' ), 'link' => "javascript:(function(){var%20d=document,enc=encodeURIComponent,share='facebook',f='" . yourls_admin_url( 'index.php' ) . "',l=d.location,p='?u='+enc(l.href)+'&t='+enc(d.title)+'&share='+share,u=f+p;try{throw('ozhismygod');}catch(z){a=function(){if(!window.open(u,'Share','width=500,height=340,left=100','_blank'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}void(0);})();", ), 'twitter' => array ( 'name' => yourls__( 'YOURLS & Twitter' ), 'color' => 'success', 'description' => yourls__( 'Create a short URL and share it on social networks, all in one click!' ), 'link' => "javascript:(function(){var%20d=document,w=window,enc=encodeURIComponent,share='twitter',e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:'%20%22'+enc(s)+'%22'),f='" . yourls_admin_url( 'index.php' ) . "',l=d.location,p='?u='+enc(l.href)+'&t='+enc(d.title)+s2+'&share='+share,u=f+p;try{throw('ozhismygod');}catch(z){a=function(){if(!w.open(u,'Share','width=780,height=265,left=100','_blank'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}void(0);})();", ), ); $bookmarks = yourls_apply_filter( 'social_bookmarklets_data', $bookmarks ); foreach( $bookmarks as $bookmark ) { echo '
'; echo '
' . $bookmark['name'] . '
'; echo ''; echo ' ' . $bookmark['name']; echo ''; echo '
'; } echo '
'; echo '
'; yourls_html_htag( 'Please note', 4 ); echo '

Be aware that a public interface will attract spammers. You are strongly advised to install anti spam plugins and any appropriate counter measure to deal with this issue.

'; echo '
'; // Display page footer yourls_template_content( 'after', 'index' );