当前位置: 首页>>代码示例>>PHP>>正文


PHP Sites::getAll方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:anniehoogendoorn,项目名称:google-analytics-app,代码行数:13,代码来源:Sites.php

示例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;
开发者ID:anniehoogendoorn,项目名称:google-analytics-app,代码行数:31,代码来源:app.php

示例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
 */
开发者ID:anniehoogendoorn,项目名称:google-analytics-app,代码行数:31,代码来源:app.php


注:本文中的Sites::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。