Skip to content

Commit

Permalink
rename API site
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-auger committed Jul 3, 2017
1 parent 2dab995 commit d9f38c1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
8 changes: 4 additions & 4 deletions LctvApi.inc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Livecoding.tv API.
* LiveEdu.tv API.
*
* @package LctvApi\LctvApi
* @since 0.0.3
* @version 0.0.8
* @version 0.0.9
*/

/* LctvApi Constants. */
Expand All @@ -20,7 +20,7 @@ if ( file_exists( CREDENTIALS_INCLUDE ) ) {


/**
* Livecoding.tv API class.
* LiveEdu.tv API class.
*
* @since 0.0.3
* @class LctvApi
Expand Down Expand Up @@ -50,7 +50,7 @@ class LctvApi {
public $client_secret = '';

/**
* Redirect url after livecoding.tv authorization.
* Redirect url after liveedu.tv authorization.
*
* Used for authorization code return from API.
*
Expand Down
17 changes: 12 additions & 5 deletions LctvApiConstants.inc
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?php
/**
* LiveEdu.tv API.
*
* @package LctvApi\Constants
* @since 0.0.8
* @version 0.0.9
*/

define( 'CREDENTIALS_FILE' , 'LctvApiCredentials.inc' ) ;
define( 'AUTHORIZE_FILE' , 'authorize.php' ) ;
define( 'CREDENTIALS_INCLUDE' , dirname( __FILE__ ) . '/' . CREDENTIALS_FILE ) ;

define( 'NOT_AUTHORIZED_MSG' , 'This app is not yet authorized with the livecoding.tv API and no ' . CREDENTIALS_FILE . ' was found. This file must exist in order to use this class. You can create this file using ' . CREDENTIALS_FILE . '.example as a reference and then initialize the API by browsing to ' . AUTHORIZE_FILE . '.' ) ;
define( 'NOT_AUTHORIZED_MSG' , 'This app is not yet authorized with the liveedu.tv API and no ' . CREDENTIALS_FILE . ' was found. This file must exist in order to use this class. You can create this file using ' . CREDENTIALS_FILE . '.example as a reference and then initialize the API by browsing to ' . AUTHORIZE_FILE . '.' ) ;
define( 'CURL_NOT_FOUND_MSG' , 'This library requires that curl be available on this server.' ) ;
define( 'CONSTANT_UNDEFINED_MSG' , 'This app is not yet authorized with the livecoding.tv API. This constant must be defined in ' . CREDENTIALS_FILE . '. Undefined constant: ' ) ;
define( 'CONSTANT_UNDEFINED_MSG' , 'This app is not yet authorized with the liveedu.tv API. This constant must be defined in ' . CREDENTIALS_FILE . '. Undefined constant: ' ) ;
define( 'MYSQL_UNSUPPORTED_MSG' , 'The version of PHP on this system does not support MySql. This is required to use the LctvApiDataStoreMySQL class.' ) ;

define( 'READ_SCOPE' , 'read' ) ; // Read basic public profile information
Expand All @@ -15,9 +22,9 @@ define( 'READUSER_SCOPE' , 'read:user' ) ; // Read your personal informatio
define( 'READCHANNEL_SCOPE', 'read:channel' ) ; // Read private channel information
define( 'CHAT_SCOPE' , 'chat' ) ; // Access chat on your behalf

define( 'LCTV_TOKEN_URL' , 'https://www.livecoding.tv/o/token/' ) ;
define( 'LCTV_AUTH_URL' , 'https://www.livecoding.tv/o/authorize/' ) ;
define( 'LCTV_API_URL' , 'https://www.livecoding.tv:443/api/' ) ;
define( 'LCTV_TOKEN_URL' , 'https://www.liveedu.tv/o/token/' ) ;
define( 'LCTV_AUTH_URL' , 'https://www.liveedu.tv/o/authorize/' ) ;
define( 'LCTV_API_URL' , 'https://www.liveedu.tv:443/api/' ) ;

define( 'STATUS_ENDPOINT' , 'v1/livestreams/' ) ;
define( 'VIEWERS_ENDPOINT' , 'v1/livestreams/' ) ;
Expand Down
3 changes: 2 additions & 1 deletion LctvApiCredentials.inc.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
/**
* Declare Livecoding.tv API credentials.
* User-defined LiveEdu.tv API credentials.
*
* @package LctvApi\Credentials
* @since 0.0.3
* @version 0.0.9
*/


Expand Down
8 changes: 8 additions & 0 deletions LctvApiHelpers.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<?php
/**
* LiveEdu.tv API helper methods.
*
* @package LctvApi\Credentials
* @since 0.0.3
* @version 0.0.9
*/


class LctvApiHelpers {

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LCTV Api Wrapper

License: GPLv3
Requires: PHP v5.4+
Version: 0.0.8
Version: 0.0.9


#### SETUP
Expand Down
16 changes: 9 additions & 7 deletions authorize.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
/**
* Authorize Livecoding.tv accounts.
* LiveEdu.tv API authorization.
*
* @package LctvApi\Authorize
* @version 0.0.9
* @since 0.0.3
*/

Expand Down Expand Up @@ -94,9 +95,10 @@
<?php
$is_set= isset($lctv_api->token) ;
$is_empty = empty($lctv_api->token) ;
$is_authorized = $is_set && isset($lctv_api->token->access_token);
$token_dump = var_export($lctv_api->token , true) ;
$token = ( ($is_set) ? (($is_empty) ? "empty" : $token_dump): "unset") ;
$access_token = ((isset( $lctv_api->token) && isset( $lctv_api->token->access_token ) ) ? $lctv_api->token->access_token : "unset") ;
$token = (($is_set) ? (($is_empty) ? "empty" : $token_dump): "unset") ;
$access_token = (($is_authorized) ? $lctv_api->token->access_token : "unset") ;
?>
<pre>tokens
* <?php echo "token=$token"; ?>\n
Expand All @@ -110,7 +112,7 @@
<div style="padding:20px;width:600px;margin:0 auto;">
<?php if ( ! $lctv_api->is_authorized() ) : ?>
<h1 style="font-size:24px;font-weight:400;">Authorize</h1>
<p>LCTV Badges use the Livecoding.tv API to get their relevant stats.
<p>LCTV Badges use the LiveEdu.tv API to get their relevant stats.
Badges that display data from public API endpoints require only the site admin to authorize this site.
Badges that display data from private API endpoints require each target user to authorize this site.
Vistors to the site will not need to authorize.
Expand All @@ -121,15 +123,15 @@
<?php if ( isset( $_GET['user'] ) && isset( $_GET['delete'] ) ) : ?>
<p>The account &ldquo;<?php echo htmlspecialchars( $_GET['user'] ); ?>&rdquo; has been disconnected.</p>
<?php else : ?>
<p>This site saves an authorization token to access your Livecoding.tv account. You may delete this token so as to stop this site from further accessing your account information.</p>
<p>To disconnect your account, first connect your account with the link above, even if you have previously done so. After authorization a disconnect link will appear.</p>
<p>This site saves an authorization token to read certain status information from your LiveEdu.tv account. This site can not modify your LiveEdu.tv account in any way. You may delete this token at any time so as to stop this site from further accessing your account information.</p>
<p>To disconnect your account, first connect your account with the link above, even if you have previously done so. After authorization a link will appear for this purpose.</p>
<?php endif; ?>
<?php else : ?>
<h1 style="font-size:24px;font-weight:400;">Authorize</h1>
<p>The account &ldquo;<?php echo htmlspecialchars( $lctv_api->auth_user ); ?>&rdquo; is now connected.</p>
<br><br>
<h1 style="font-size:24px;font-weight:400;">Remove Authorization</h1>
<p>This site saves an authorization token to access your Livecoding.tv account. You may delete this token so as to stop this site from further accessing your account information with the link below.</p>
<p>This site saves an authorization token to read certain status information from your LiveEdu.tv account. This site can not modify your LiveEdu.tv account in any way. You may delete this token so as to stop this site from further accessing your account information with the link below.</p>
<p><a href="<?php echo $lctv_api->redirect_url; ?>?user=<?php echo urlencode( $lctv_api->auth_user ); ?>&delete=<?php echo urlencode( $lctv_api->token->delete_id ); ?>">Disconnect your account</a></p>
<?php endif; ?>
<br><br>
Expand Down

0 comments on commit d9f38c1

Please sign in to comment.