diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2015-05-07 23:14:47 -0500 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2015-05-07 23:14:47 -0500 |
commit | 3dc3919ce1b5336861979cde56884842615c967b (patch) | |
tree | f0a2418290cecd15f20c834bb071ffa9f3694b09 /includes/google-api-php-client-master/examples/templates | |
parent | 29e872fbc6c552ef02208fe9fa5416b69773aa38 (diff) | |
parent | c517b645c8723b5f4d20cbb91cbc4b9f45579cbb (diff) | |
download | pathery-3dc3919ce1b5336861979cde56884842615c967b.tar.xz |
Merge branch 'master' of git.raylu.net:pathery
Diffstat (limited to 'includes/google-api-php-client-master/examples/templates')
-rw-r--r-- | includes/google-api-php-client-master/examples/templates/base.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/includes/google-api-php-client-master/examples/templates/base.php b/includes/google-api-php-client-master/examples/templates/base.php new file mode 100644 index 0000000..34241e9 --- /dev/null +++ b/includes/google-api-php-client-master/examples/templates/base.php @@ -0,0 +1,90 @@ +<?php +/* Ad hoc functions to make the examples marginally prettier.*/ +function isWebRequest() +{ + return isset($_SERVER['HTTP_USER_AGENT']); +} + +function pageHeader($title) +{ + $ret = ""; + if (isWebRequest()) { + $ret .= "<!doctype html> + <html> + <head> + <title>" . $title . "</title> + <link href='styles/style.css' rel='stylesheet' type='text/css' /> + </head> + <body>\n"; + if ($_SERVER['PHP_SELF'] != "/index.php") { + $ret .= "<p><a href='index.php'>Back</a></p>"; + } + $ret .= "<header><h1>" . $title . "</h1></header>"; + } + return $ret; +} + + +function pageFooter($file = null) +{ + $ret = ""; + if (isWebRequest()) { + // Echo the code if in an example. + if ($file) { + $ret .= "<h3>Code:</h3>"; + $ret .= "<pre class='code'>"; + $ret .= htmlspecialchars(file_get_contents($file)); + $ret .= "</pre>"; + } + $ret .= "</html>"; + } + return $ret; +} + +function missingApiKeyWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set a Simple API Access key from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set a Simple API Access key from the Google API console:"; + $ret .= "\nhttp://developers.google.com/console\n"; + } + return $ret; +} + +function missingClientSecretsWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set Client ID, Client Secret and Redirect URI from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set Client ID, Client Secret and Redirect URI from the"; + $ret .= " Google API console:\nhttp://developers.google.com/console\n"; + } + return $ret; +} + +function missingServiceAccountDetailsWarning() +{ + $ret = ""; + if (isWebRequest()) { + $ret = " + <h3 class='warn'> + Warning: You need to set Client ID, Email address and the location of the Key from the + <a href='http://developers.google.com/console'>Google API console</a> + </h3>"; + } else { + $ret = "Warning: You need to set Client ID, Email address and the location of the Key from the"; + $ret .= " Google API console:\nhttp://developers.google.com/console\n"; + } + return $ret; +} |