* @since 0.0.3 */ /** Bail if no channel name. */ if (!isset($_GET['channel']) || empty($_GET['channel'])) { exit; } /** Set the channel name. */ $channel = strtolower($_GET['channel']); /** Set the online message. */ $online_message = isset($_GET['online']) && !empty($_GET['online']) ? $_GET['online'] : 'online'; /** Set the offline message. */ $offline_message = isset($_GET['offline']) && !empty($_GET['offline']) ? $_GET['offline'] : 'offline'; /** Initialize. */ require_once 'lctv_badges_init.php'; /** Load the API. */ $lctv_api = new LCTVAPI(array('data_store' => LCTVAPI_DATA_STORE_CLASS, 'client_id' => LCTV_CLIENT_ID, 'client_secret' => LCTV_CLIENT_SECRET, 'user' => LCTV_MASTER_USER)); /** Bail if API isn't authorized. */ if (!$lctv_api->is_authorized()) { header("Content-type:image/svg+xml"); echo get_badge_svg('livecoding.tv', 'error', '#e05d44'); exit; } /** Get live streaming info for a channel. */ $api_request = $lctv_api->api_request('v1/livestreams/' . urlencode($channel) . '/'); /** Bail on error. */ if ($api_request === false) { header("Content-type:image/svg+xml"); echo get_badge_svg('livecoding.tv', 'error', '#e05d44'); exit; } /** API returned an error. This happens if user is not streaming. */
* @param string channel (required) LCTV channel name. * @param string link (optional) true/false to automatically link to channel. * * @package LCTVBadges\Badges * @since 0.0.4 */ /** Bail if no channel name. */ if (!isset($_GET['channel']) || empty($_GET['channel'])) { exit; } /** Set the channel name. */ $channel = strtolower($_GET['channel']); /** Initialize. */ require_once 'lctv_badges_init.php'; /** Load the API. */ $lctv_api = new LCTVAPI(array('data_store' => LCTVAPI_DATA_STORE_CLASS, 'client_id' => LCTV_CLIENT_ID, 'client_secret' => LCTV_CLIENT_SECRET, 'user' => $channel)); /** Bail if API isn't authorized. */ if (!$lctv_api->is_authorized()) { header("Content-type:image/svg+xml"); echo get_badge_svg('lctv last streamed', 'error', '#e05d44'); exit; } /** Get users latest videos. */ $api_request = $lctv_api->api_request('v1/user/videos/latest/'); /** Bail on error. */ if ($api_request === false || isset($api->request->detail)) { header("Content-type:image/svg+xml"); echo get_badge_svg('lctv last streamed', 'error', '#e05d44'); exit; } /** Check to auto link. */
* @param string channel (required) LCTV channel name. * @param string link (optional) true/false to automatically link to channel. * * @package LCTVBadges\Badges * @since 0.0.3 */ /** Bail if no channel name. */ if (!isset($_GET['channel']) || empty($_GET['channel'])) { exit; } /** Set the channel name. */ $channel = strtolower($_GET['channel']); /** Initialize. */ require_once 'lctv_badges_init.php'; /** Load the API. */ $lctv_api = new LCTVAPI(array('data_store' => LCTVAPI_DATA_STORE_CLASS, 'client_id' => LCTV_CLIENT_ID, 'client_secret' => LCTV_CLIENT_SECRET, 'user' => $channel)); /** Bail if API isn't authorized. */ if (!$lctv_api->is_authorized()) { header("Content-type:image/svg+xml"); echo get_badge_svg('lctv followers', 'error', '#e05d44'); exit; } /** Get user followers. */ $api_request = $lctv_api->api_request('v1/user/followers/'); /** Bail on error. */ if ($api_request === false || isset($api_request->result->detail)) { header("Content-type:image/svg+xml"); echo get_badge_svg('lctv followers', 'error', '#e05d44'); exit; } /** Count number of followers. */
* @param string channel (required) LCTV channel name. * @param string link (optional) true/false to automatically link to channel. * * @package LCTVBadges\Badges * @since 0.0.7 */ /** Bail if no channel name. */ if (!isset($_GET['channel']) || empty($_GET['channel'])) { exit; } /** Set the channel name. */ $channel = strtolower($_GET['channel']); /** Initialize. */ require_once 'lctv_badges_init.php'; /** Load the API. */ $lctv_api = new LCTVAPI(array('data_store' => LCTVAPI_DATA_STORE_CLASS, 'client_id' => LCTV_CLIENT_ID, 'client_secret' => LCTV_CLIENT_SECRET, 'user' => LCTV_MASTER_USER)); /** Bail if API isn't authorized. */ if (!$lctv_api->is_authorized()) { header("Content-type:image/svg+xml"); echo get_badge_svg('livecoding.tv', 'error', '#e05d44'); exit; } /** Get live streaming info for a channel. */ $api_request = $lctv_api->api_request('v1/scheduledbroadcast/?limit=500'); /** Bail on error. */ if ($api_request === false || isset($api_request->result->detail)) { header("Content-type:image/svg+xml"); echo get_badge_svg('livecoding.tv', 'error', '#e05d44'); exit; } /** Get scheduled streams and search for channel name. */
<?php /** * Authorize Livecoding.tv accounts. * * @package LCTVBadges\Authorize * @since 0.0.3 */ /** Initialize. */ require_once 'lctv_badges_init.php'; /** Load the API with no user. */ $lctv_api = new LCTVAPI(array('data_store' => LCTVAPI_DATA_STORE_CLASS, 'client_id' => LCTV_CLIENT_ID, 'client_secret' => LCTV_CLIENT_SECRET, 'redirect_url' => LCTV_REDIRECT_URL, 'user' => '')); /** Authorization html output. */ ?> <!DOCTYPE html> <html lang="en-US"> <head> <title>LCTV Badges Authorization</title> </head> <body style="font-family:Helvetica,Arial,sans-serif;font-size:15px;font-weight:400;color:#111;"> <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>Some badges require access to your Livecoding.tv account information. Authorize account access with the link below.</p> <p><a href="<?php echo $lctv_api->get_authorization_url(); ?> ">Connect your account</a></p> <br><br>