Esempio n. 1
0
        call to the service methods to return the query
        rather than immediately executing.
       ************************************************/
    $client->setUseBatch(true);
    /************************************************
       We then create a batch, and add each query we 
       want to execute with keys of our choice - these
       keys will be reflected in the returned array.
      ************************************************/
    $batch = new Google_Http_Batch($client);
    $optParams = array('filter' => 'free-ebooks');
    $req1 = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
    $batch->add($req1, "thoreau");
    $req2 = $service->volumes->listVolumes('George Bernard Shaw', $optParams);
    $batch->add($req2, "shaw");
    /************************************************
        Executing the batch will send all requests off
        at once.
       ************************************************/
    $results = $batch->execute();
    echo "<h3>Results Of Call 1:</h3>";
    foreach ($results['response-thoreau'] as $item) {
        echo $item['volumeInfo']['title'], "<br /> \n";
    }
    echo "<h3>Results Of Call 2:</h3>";
    foreach ($results['response-shaw'] as $item) {
        echo $item['volumeInfo']['title'], "<br /> \n";
    }
}
echo pageFooter(__FILE__);
Esempio n. 2
0
<?php

include_once "templates/base.php";
if (!isWebRequest()) {
    echo "To view this page on a webserver using PHP 5.4 or above run: \n\t\n    php -S localhost:8080\n";
    exit;
}
echo pageHeader("PHP Library Examples");
?>
<ul>
  <li><a href="simple-query.php">A query using simple API access</a></li>
  <li><a href="user-example.php">A query for user data, using OAuth 2.0 authentication.</a></li>
  <li><a href="batch.php">An example of combining multiple calls into a batch request</a></li>
  <li><a href="service-account.php">A query using the service account functionality.</a></li>
  <li><a href="simplefileupload.php">An example of a small file upload.</a></li>
  <li><a href="fileupload.php">An example of a large file upload.</a></li>
  <li><a href="idtoken.php">An example of verifying and retrieving the id token.</a></li>
  <li><a href="multi-api.php">An example of using multiple APIs.</a></li>
</ul>
<?php 
echo pageFooter();
Esempio n. 3
0
						<div class='title'>Password:</div>
						<input id='password' class='value' type='password' name='password' value=''>
						<div class="validation-hint" />
					</div>
				</form>
			</p>
			<div class="clear"/>
			<p class="info">
				Enter username and password, and click "Install" to finish installation.
			</p>
			<p>
				<a id="button-install" href="#" class="btn green">Install</a>
			</p>
		</div>
		<?php 
pageFooter();
?>
	</body>
	
	<script type="text/javascript">
		function validate() {
			$(".user-data").removeClass("invalid");
			$(".validation-hint").html("");
		
			var result = true;
			if ($("#username").val().length == 0) {
				$("#admin-username").addClass("invalid");
				$("#admin-username > .validation-hint").html("Username cannot be empty");
				result = false;
			}
			if ($("#password").val().length == 0) {
Esempio n. 4
0
function showPage($content)
{
    return pageHeader() . generalContent() . pageNavbar() . $content . pageFooter();
}
Esempio n. 5
0
function articlePage($section, $filePath)
{
    // -----[ CACHE LITE ]-----
    // Cache Lite is optional but recommended as it rolls and stores the page as HTML
    // and avoids having to rebuild the page everytime it is called. You will need to clear
    // the cache if you update the page. You could create a seperate "clearcache.php" page.
    // See: "/site/orgile/clearcache.php".
    require_once 'Cache/Lite/Output.php';
    $options = array('cacheDir' => '/srv/www/' . SITEURL . '/www/site/ramcache/', 'lifeTime' => '604800');
    // Define cache directory and cache lifetime (168 hours).
    $cache = new Cache_Lite_Output($options);
    // Begin cache lite.
    if (!$cache->start($filePath)) {
        if (is_file($filePath)) {
            $fileData = file_get_contents($filePath, NULL, NULL, 0, 1000);
            // This reads the first 1000 chars for speed.
            // Pulls details from .org file header.
            $regex = '/^#\\+\\w*:(.*)/m';
            preg_match_all($regex, $fileData, $matches);
            $title = trim($matches[1][0]);
            $author = trim($matches[1][1]);
            $date = trim($matches[1][2]);
            $date = date('c', cleanDate($date));
            $description = trim($matches[1][3]);
            $description = strip_tags($description);
            // Create HTML header.
            $htmlHeader = htmlHeader($date, $author, $description, $title, dropDash($section));
            // Starts the object buffer.
            ob_start();
            pageHeader();
            print '<div id="columnX">';
            fetchOne($filePath, 'orgile');
            print '</div>';
            print '<div id="columnY">';
            print '<aside>';
            print '<div class="content">';
            print '<h2><a href="/' . spaceDash($section) . '/" title="' . spaceDash($section) . '">' . spaceDash($section) . '</a>:</h2>';
            print '<ul class="side">';
            fetchSome($section, 'list', '0', 'sort');
            // See function below.
            print '</ul><br>';
            print '</div>' . sideContent();
            print '</aside>';
            print '</div>';
            pageFooter();
            // End the object buffer.
            $content = ob_get_contents();
            ob_end_clean();
            $content = $htmlHeader . $content;
        }
        // End: is_file($filePath).
        print $content;
        // End cache.
        $cache->end();
    }
    // End: cache lite.
}
Esempio n. 6
0
function managePage($text, $onload = '')
{
    $adminbar = adminBar();
    $body = <<<EOF
\t<body{$onload}>
\t\t<div class="adminbar">
\t\t\t{$adminbar}
\t\t</div>
\t\t<div class="logo">
EOF;
    $body .= TINYIB_LOGO . TINYIB_BOARDDESC . <<<EOF
\t\t</div>
\t\t<hr width="90%" size="1">
\t\t<div class="replymode">Manage mode</div>
\t\t{$text}
\t\t<hr>
EOF;
    return pageHeader() . $body . pageFooter();
}
        pageHeader($page);
        // If the page exists, display it and the footer with an "Edit" link
        if (is_readable(pageToFile($page))) {
            // Get the contents of the page from the file it's saved in
            $text = file_get_contents(pageToFile($page));
            // Convert Markdown syntax (using Markdown library loaded above)
            $text = Markdown::defaultTransform($text);
            // Make bare [links] link to other wiki pages
            $text = wikiLinks($text);
            // Display the page
            echo $text;
            // Display the footer
            pageFooter($page, true);
        } else {
            edit($page, true);
            pageFooter($page, false);
        }
    }
}
// The page header -- pretty simple, just the title and the usual HTML
// pleasantries
function pageheader($page)
{
    ?>
<html>
<head>
<title>Wiki: <?php 
    echo htmlentities($page);
    ?>
</title>
</head>
Esempio n. 8
0
function managePage($text, $onload = '')
{
    global $tinyib;
    $adminbar = adminBar();
    $body = <<<EOF
\t<body{$onload}>
\t\t<div class="adminbar">
\t\t\t{$adminbar}
\t\t</div>
\t\t<div class="logo">
\t\t\t{$tinyib['logo']}
\t\t\t{$tinyib['boarddescription']}
\t\t</div>
\t\t<hr width="90%" size="1">
\t\t<div class="replymode">Manage mode</div>
\t\t{$text}
\t\t<hr>
EOF;
    return pageHeader() . $body . pageFooter();
}
Esempio n. 9
0
function makeRequests($service)
{
    print "\n";
    $accounts = GetAllAccounts::run($service, MAX_LIST_PAGE_SIZE);
    if (isset($accounts) && !empty($accounts)) {
        // Get an example account ID, so we can run the following sample.
        $exampleAccountId = $accounts[0]['id'];
        $adClients = GetAllAdClients::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        echo pageFooter(__FILE__);
        if (!empty($adClients)) {
            // Get an ad client ID, so we can run the rest of the samples.
            $exampleAdClient = end($adClients);
            $exampleAdClientId = $exampleAdClient['id'];
            $customChannels = GetAllCustomChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            GetAllUrlChannels::run($service, $exampleAccountId, $exampleAdClientId, MAX_LIST_PAGE_SIZE);
            GenerateReport::run($service, $exampleAccountId, $exampleAdClientId);
            GenerateReportWithPaging::run($service, $exampleAccountId, $exampleAdClientId, MAX_REPORT_PAGE_SIZE);
        } else {
            print 'No ad clients found, unable to run dependant examples.';
        }
        $savedReports = GetAllSavedReports::run($service, $exampleAccountId, MAX_LIST_PAGE_SIZE);
        if (!empty($savedReports)) {
            // Get an example saved report ID, so we can run the following sample.
            $exampleSavedReportId = $savedReports[0]['id'];
            GenerateSavedReport::run($service, $exampleAccountId, $exampleSavedReportId);
        } else {
            print 'No saved reports found, unable to run dependant example.';
        }
        GetAllAlerts::run($service, $exampleAccountId);
        GetAllDimensions::run($service, $exampleAccountId);
        GetAllMetrics::run($service, $exampleAccountId);
    }
}
Esempio n. 10
0
/**
 * Output a table of features per all platforms.
 *
 * @param array $features
 */
function viewFeatureTable($features = array())
{
    global $supported;
    $platforms = array_keys($supported);
    pageHeader();
    echo '<h2 class="FeatureTitle">Data currently supported per platform</h2>';
    echo '<p>Click any platform name for details, or <a href="/" style="text-decoration:underline;">go back</a>.</p>';
    echo '<table class="Features"><thead><tr>';
    // Header row of labels for each platform
    echo '<th><i>Feature</i></th>';
    foreach ($platforms as $slug) {
        echo '<th class="Platform"><div><span><a href="?features=1&type=' . $slug . '">' . $supported[$slug]['name'] . '</a></span></div></th>';
    }
    echo '</tr></thead><tbody>';
    // Checklist of features per platform.
    foreach ($features as $feature => $trash) {
        // Name
        echo '<tr><td class="FeatureName">' . featureName($feature) . '</td>';
        // Status per platform.
        foreach ($platforms as $platform) {
            echo '<td>' . featureStatus($platform, $feature, false) . '</td>';
        }
        echo '</tr>';
    }
    echo '</tbody></table>';
    pageFooter();
}
Esempio n. 11
0
<?php

include "glob_func.php";
if (isset($_GET['mypass']) && $_GET['mypass'] == 'february') {
    $str = getDateSections();
    if (isset($_GET['date'])) {
        $str .= getListOfBuyClicks($_GET['date']);
    }
    echo pageHeader() . $str . getOtherAdmins() . pageFooter();
} else {
    echo "404 Page not found";
}
function getDateSections()
{
    global $mycatid;
    $lnk = dbConnect('localhost', 'root', 'lyntik');
    $query = "SELECT DISTINCT date as sdate FROM buylog WHERE mycat_id={$mycatid}";
    $res = exec_query($query);
    $str = "<div class=\"date_sections\">";
    $i = 0;
    $j = 0;
    $str .= "<div class=\"date_sections_row\">";
    while ($rows = fetch_array($res)) {
        $j++;
        $str .= "<a href=\"myhist.php?mypass=february&date=" . $rows['sdate'] . "\">" . $rows['sdate'] . "</a>";
        $i++;
        if ($i > 10) {
            $str .= closeFloat() . "</div><div class=\"date_sections_row\">";
            $i = 0;
        }
    }
Esempio n. 12
0
            $body = get_order_details($_GET['id']);
        } else {
            $body = pageBody(1);
        }
        $finish = true;
    }
    if ($_GET['mode'] == 'allord') {
        $mode = 0;
    }
    if ($_GET['mode'] == 'sql') {
        $finish = true;
        $body = get_sql_form();
    }
    if ($_GET['mode'] == 'social') {
        $finish = true;
        $body = get_social_users();
    }
    if ($_GET['mode'] == 'links') {
        $finish = true;
        $body = get_sape_links();
    }
    if (!$finish) {
        $body = pageBody($mode);
    }
} else {
    if (!$finish) {
        $body = pageBody(1);
    }
}
echo pageHeader() . $body . pageFooter();