From aea2a59ad7dcaee09fd7164f12475bf6a3761648 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Wed, 26 Sep 2012 19:29:56 +0000 Subject: [PATCH] Better sample public interface (less code, less ugly) git-svn-id: http://yourls.googlecode.com/svn/trunk@764 12232710-3e20-11de-b438-597f59cd7555 --- sample-public-front-page.php.txt | 155 +++++++++++-------------------- 1 file changed, 53 insertions(+), 102 deletions(-) diff --git a/sample-public-front-page.php.txt b/sample-public-front-page.php.txt index 3b9b25f..0f30504 100644 --- a/sample-public-front-page.php.txt +++ b/sample-public-front-page.php.txt @@ -1,123 +1,74 @@ - - - - -YOURLS Public Interface Sample - - - - - - - - -

YOURLS: Your Own URL Shortener

+// Insert markup and all CSS & JS files +yourls_html_head(); -
+// Display title +$site = trim( YOURLS_SITE, 'http://' ); +echo "

$site's URL Shortener

\n"; - URL has been shortened -

Original URL: $url

-

Short URL: $shorturl

-

$message

-RESULT; - - // Include the Copy box and the Quick Share box - yourls_share_box( $url, $shorturl, $title ); + $url = yourls_sanitize_url( $_REQUEST['url'] ); + $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ; + $title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ; - // Part to be executed when no form has been submitted - } else { + $return = yourls_add_new_link( $url, $keyword, $title ); + $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : ''; + $message = isset( $return['message'] ) ? $return['message'] : ''; + $title = isset( $return['title'] ) ? $return['title'] : ''; + + // Include the Copy box and the Quick Share box + yourls_share_box( $url, $shorturl, $title ); + + // Initialize clipboard -- requires js/share.js and js/jquery.zclip.min.js to be properly loaded + echo << + init_clipboard(); + +JS; + +// Part to be executed when no form has been submitted +} else { + $site = YOURLS_SITE; + // Display the form echo <<Enter a new URL to shorten
-

-

-

-

+

+

+

+

HTML; - } - - ?> +} +// Display bookmarklet hint and link +echo << -

bookmarklet - -

+

Bookmarklet

+ +

Bookmark this link (drag to bookmark bar) : Shorten +BOOK; -

- - \ No newline at end of file +// Display page footer +yourls_html_footer(); -- 2.45.0