本文整理汇总了PHP中Sites::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Sites::getAll方法的具体用法?PHP Sites::getAll怎么用?PHP Sites::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sites
的用法示例。
在下文中一共展示了Sites::getAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
static function find($search_id)
{
$found_site = '';
$sites = Sites::getAll();
foreach ($sites as $site) {
// $site_id = $site->getId();
if ($id === $search_id) {
$found_site = $site;
print_r($found_site);
return $found_site;
}
}
}
示例2: PDO
//setting up connection to our database
$DB = new PDO($server, $username, $password);
//Throw an exception when an error is encountered in the query
$DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$DB->exec("SET NAMES 'utf8'");
} catch (Exception $e) {
echo "Could not connect to the database";
exit;
}
$app = new Silex\Application();
$app["debug"] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../../views'));
use Symfony\Component\HttpFoundation\Request;
Request::enableHttpMethodParameterOverride();
/**
* Routing to twig templete views
*/
$app->get("/", function () use($app) {
return $app['twig']->render('index.html.twig', array('sites' => Sites::getAll()));
});
$app->get('/site/{id}', function ($id) use($app) {
$sites = Sites::getAll();
function name($sites, $id)
{
$id = $id - 1;
return $sites[$id];
}
$sites = name($sites, $id);
return $app['twig']->render('site.html.twig', array('sites' => $sites, 'analytics' => ReturnedAnalytics::getAll($id)));
});
return $app;
示例3: Google_Auth_AssertionCredentials
// Read the generated client_secrets.p12 key.
$cred = new Google_Auth_AssertionCredentials($service_account_email, array(Google_Service_Analytics::ANALYTICS_READONLY), $key);
$client->setAssertionCredentials($cred);
if ($client->getAuth()->isAccessTokenExpired()) {
$client->getAuth()->refreshTokenWithAssertion($cred);
}
return $analytics;
}
/**
* Get Analytics API instance
*/
$analytics = getService($google_account['email'], $google_account['key']);
/**
* Gets objects from the site table
*/
$site_details = Sites::getAll();
$site_details_length = sizeof($site_details);
if ($site_details_length <= 0) {
trigger_error('Size of site_details_length must be greater than zero', E_USER_NOTICE);
error_log($today . "The sites tables has return zero sites from the database \n", 3, __DIR__ . "/../../log/error.log");
exit;
}
echo "*******************" . "\n";
echo "* total sites : " . $site_details_length . " *" . "\n";
echo "*******************" . "\n";
/**
* Query the Analytics data.
* date, source, medium,channel_grouping, device_category, landing_page_path, sessions,
* transactions, transaction_revenue, page_views, bounces, session_duration, hits, total_events,
* unique_events, users, entrances, exits
*/