Пример #1
0
    }
    // If the action is set dispatch the action if supported
    if (isset($_GET["action"])) {
        $action = $_GET["action"];
        if (!in_array($action, $actions)) {
            die('Unsupported action:' . $action . "\n");
        }
        // Render the required action.
        require_once 'examples/' . $action . '.php';
        $class = ucfirst($action);
        $example = new $class($auth->getAdSenseService());
        $title = actionNameToWords($action) . ' example';
        printHtmlHeader($title);
        $example->render();
        printHtmlFooter();
        $auth->refreshToken();
    } else {
        // Show the list of links to supported actions.
        printHtmlHeader('AdSense Management API PHP usage examples.');
        printIndex($actions);
        printHtmlFooter();
    }
} catch (Exception $e) {
    die('Runtime error: ' . $e->getMessage() . "\n" . $e->getTraceAsString());
}
/**
 * Builds an array containing the supported actions.
 * @return array
 */
function getSupportedActions()
{