pastebin

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