From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- zend/demos/Zend/Gdata/YouTubeVideoApp/index.php | 193 ++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100755 zend/demos/Zend/Gdata/YouTubeVideoApp/index.php (limited to 'zend/demos/Zend/Gdata/YouTubeVideoApp/index.php') diff --git a/zend/demos/Zend/Gdata/YouTubeVideoApp/index.php b/zend/demos/Zend/Gdata/YouTubeVideoApp/index.php new file mode 100755 index 0000000..45cee26 --- /dev/null +++ b/zend/demos/Zend/Gdata/YouTubeVideoApp/index.php @@ -0,0 +1,193 @@ += 5.2.11 + * This sample is run from within a web browser. These files are required: + * session_details.php - a script to view log output and session variables + * operations.php - the main logic, which interfaces with the YouTube API + * index.php - the HTML to represent the web UI, contains some PHP + * video_app.css - the CSS to define the interface style + * video_app.js - the JavaScript used to provide the video list AJAX interface + * + * NOTE: If using in production, some additional precautions with regards + * to filtering the input data should be used. This code is designed only + * for demonstration purposes. + */ +session_start(); + +/** + * Set your developer key here. + * + * NOTE: In a production application you may want to store this information in + * an external file. + */ +$_SESSION['developerKey'] = ''; + +/** + * Convert HTTP status into normal text. + * + * @param number $status HTTP status received after posting syndicated upload + * @param string $code Alphanumeric description of error + * @param string $videoId (optional) Video id received back to which the status + * code refers to + */ +function uploadStatus($status, $code = null, $videoId = null) +{ + switch ($status) { + case $status < 400: + echo 'Success ! Entry created (id: '. $videoId . + ') (check details)'; + break; + default: + echo 'There seems to have been an error: '. $code . + '(check details)'; + } +} + +/** + * Helper function to check whether a session token has been set + * + * @return boolean Returns true if a session token has been set + */ +function authenticated() +{ + if (isset($_SESSION['sessionToken'])) { + return true; + } +} + +/** + * Helper function to print a list of authenticated actions for a user. + */ +function printAuthenticatedActions() +{ + print <<

Authenticated Actions

+ +END; +} +?> + + + + + YouTube data API Video Browser in PHP + + + + + +
+
+

YouTube data API Video App in PHP

+ click to examine session variables
+ +
+ +
+
+ +
Authentication status: + +END; + } else { + print <<Click here to generate authentication link +
+END; + } + ?> +
+ +
+ ' . + uploadStatus($_GET['status'], $code, $id) . + '
'; + } + ?> + + + +
+
+
+
+
+ +
+
+
+
+
+
+ + + -- cgit v1.2.3