<script type="text/javascript"> document.getElementById('manual-button').style.display = 'none'; document.getElementById('oauth_submit').submit(); </script> </div> </div> </body> </html> <?php } else { if (!empty($_REQUEST['error'])) { header("Location: " . $_SESSION['wp_return']); } else { $url = $envato->get_authorization_url(); header("Location: " . $url); //echo '<a href="'.$url.'">'.$url.'</a>'; } } /** * Exception handling class. */ class EnvatoException extends Exception { } class envato_api_basic { private static $instance = null; public static function getInstance() {
$return[] = $items[$item_id]; } } @header('Content-type: application/json'); echo json_encode($return); exit; //redirect to Envato authorization page } elseif (isset($_GET['auth'])) { @session_start(); $_SESSION['returnto'] = $_GET['returnto']; $_SESSION['item_id'] = $_GET['item_id']; $_SESSION['slug'] = $_GET['slug']; $_SESSION['auth'] = $_GET['auth']; $_SESSION['time'] = time(); if (!empty($_SESSION['returnto']) && !empty($_SESSION['returnto']) && !empty($_SESSION['returnto'])) { $url = $api->get_authorization_url(); } else { $url = $api->get_authorization_url(); } header('Location: ' . $url); exit; //return from the Envato authorization page } elseif (isset($_GET['code'])) { @session_start(); $response = $api->get_authentication($_GET['code']); if (isset($response['error'])) { $url = buildquery($_SESSION['returnto'], array('mymail_error' => urlencode($response['error_description']), 'mymail_nonce' => $_SESSION['auth'])); } else { if (isset($response['refresh_token']) && isset($response['access_token'])) { $api->set_personal_token($response['access_token']); $params = buildquery(array('item_id' => (int) $_SESSION['item_id'], 'shorten_url' => 'true'));