/** * Displays the requested action. */ function displayAction($action) { global $service; // Render the required action. include_once 'examples/' . $action . '.php'; $class = ucfirst($action); $example = new $class($service); printHtmlHeader($example->getName()); try { $example->execute(); } catch (Google_Exception $ex) { print_r($ex); print 'An error as occurred while calling the example:<br/>'; print $ex->getMessage(); } printSampleHtmlFooter(); }
<?php } else { if (addComment($blogid, $comment) !== false) { if (!$comment['secret']) { $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $comment['entry']); $pool->setQualifier("draft", "eq", 0); $pool->setQualifier("visibility", "eq", 3); $pool->setQualifier("acceptcomment", "eq", 1); if ($row = $pool->getRow()) { sendCommentPing($comment['entry'], $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$row['slogan']}" : $comment['entry']), !doesHaveMembership() ? $comment['name'] : User::getName(), !doesHaveMembership() ? $comment['homepage'] : User::getHomepage()); } } $skin = new Skin($context->getProperty('skin.skin')); printHtmlHeader(); ?> <script type="text/javascript"> //<![CDATA[ alert("<?php echo _text('댓글이 등록되었습니다.'); ?> "); <?php notifyComment(); $entry = array(); $entry['id'] = $comment['entry']; $entry['slogan'] = getSloganById($blogid, $entry['id']); $tempComments = revertTempTags(removeAllTags(getCommentView($entry, $skin))); $tempRecentComments = revertTempTags(getRecentCommentsView(getRecentComments($blogid), null, $skin->recentCommentItem)); ?>
$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() { $actions = array(); $dirHandler = opendir('examples'); while ($actionFile = readdir($dirHandler)) {
<?php /** * Simple Contact Management App * * add.php - Add a new contact * */ require_once 'functions.php'; $error = null; if (!empty($_POST)) { // Handle form submission and redirect to home page } printHtmlHeader("Add Contact"); if ($error) { ?> <div class="error"><?php echo htmlspecialchars($error); ?> </div> <?php } ?> <form method="post"> <dl> <dt>Contact Name:</dt> <dd><input type="text" name="name" value="" /></dd> <dt>Contact Email:</dt> <dd><input type="email" name="email" value="" /></dd>
<?php /** * Simple Contact Management App * * index.php - home page / list contacts * */ require_once 'functions.php'; $contacts = getContactsList(); printHtmlHeader("My Contact Manager"); if (!empty($contacts)) { ?> <?php echo count($contacts); ?> contacts found: <table id="contacts-list"> <tr> <th>Contact ID</th> <th>Contact Name</th> </tr> <?php foreach ($contacts as $id => $name) { ?> <tr> <td><?php echo $id; ?> </td>
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($service); printHtmlHeader($example->getName()); try { $example->execute(); } catch (apiException $ex) { printf('An error as occurred while calling the example:<br/>'); printf($ex->getMessage()); } printSampleHtmlFooter(); } else { // Show the list of links to supported actions. printHtmlHeader('Double Click Bid Manager API PHP usage examples.'); printExamplesIndex($actions); printHtmlFooter(); } // The access token may have been updated. $_SESSION['service_token'] = $client->getAccessToken(); } /** * Builds an array containing the supported actions. */ function getSupportedActions() { return array('GetLatestReport', 'DownloadLineItems', 'UploadLineItems'); }
fprintf($html, '<table cellpadding="0" cellspacing="0"><tbody>'); printHtmlHeader($html, "Organization"); $index = 1; foreach ($orgData as $org => $values) { if ($index++ > 20) { break; } printHtmlRow($html, $org, $values, $index % 2 == 1); } if ($index == 1) { printHtmlRow($html, "none", newDataSet(), false); } fprintf($html, "</tbody></table>"); fprintf($html, "<h3>Top 20 Users</h3>"); fprintf($html, '<table cellpadding="0" cellspacing="0"><tbody>'); printHtmlHeader($html, "User"); $index = 1; foreach ($userData as $user => $values) { if ($index++ > 20) { break; } printHtmlRow($html, $user, $values, $index % 2 == 1); } if ($index == 1) { printHtmlRow($html, "none", newDataSet(), false); } fprintf($html, "</tbody></table>"); fprintf($html, "<h3>Top 20 Forums</h3>"); fprintf($html, '<table cellpadding="0" cellspacing="0"><tbody>'); printForumHtmlHeader($html, "Org/Forum"); $index = 1;
$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->getAdSenseHostService()); $title = actionNameToWords($action) . ' example'; printHtmlHeader($title); $example->render(); printHtmlFooter(); $auth->refreshToken(); } else { // Show the list of links to supported actions. printHtmlHeader('AdSense Host 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() { $actions = array(); $dirHandler = opendir('examples'); while ($actionFile = readdir($dirHandler)) {
} // Render the required action. require_once 'examples/' . $action . '.php'; $class = ucfirst($action); $example = new $class($service); printHtmlHeader($example->getName()); try { $example->execute(); } catch (Google_Exception $ex) { printf('An error as occurred while calling the example:<br/>'); printf($ex->getMessage()); } printSampleHtmlFooter(); } else { // Show the list of links to supported actions. printHtmlHeader('Ad Exchange Buyer API PHP usage examples.'); printExamplesIndex($actions); printHtmlFooter(); } // The access token may have been updated. $_SESSION['token'] = $client->getAccessToken(); } else { $authUrl = $client->createAuthUrl(); print "<a class='login' href='{$authUrl}'>Connect Me!</a>"; } /** * Builds an array containing the supported actions. */ function getSupportedActions() { return array('GetAllAccounts', 'GetCreative', 'GetDirectDeals', 'SubmitCreative', 'UpdateAccount');
* contact.php - show contact information * */ require_once 'functions.php'; if (!isset($_GET['cid'])) { // If no contact ID specified, redirect to the home page header("Location: index.php"); exit(0); } $contact = getContactInfo($_GET['cid']); if ($contact) { $pageTitle = "Contact Info: " . $contact['name']; } else { $pageTitle = "Contact Not Found"; } printHtmlHeader($pageTitle); if ($contact) { ?> <h2><?php echo $contact['name']; ?> </h2> <ul id="contact-info"> <li><strong>Email: </strong> <a href="mailto:<?php echo htmlspecialchars($contact['email']); ?> "><?php echo htmlspecialchars($contact['email']); ?> </a>
$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->getAdExchangeSellerService()); $title = actionNameToWords($action) . ' example'; printHtmlHeader($title); $example->render(); printHtmlFooter(); $auth->refreshToken(); } else { // Show the list of links to supported actions. printHtmlHeader('AdExchange Seller REST 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() { $actions = array(); $dirHandler = opendir('examples'); while ($actionFile = readdir($dirHandler)) {