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


PHP current_collation函数代码示例

本文整理汇总了PHP中current_collation函数的典型用法代码示例。如果您正苦于以下问题:PHP current_collation函数的具体用法?PHP current_collation怎么用?PHP current_collation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了current_collation函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate_all_variables

    echo 'checked="checked"';
}
?>
 /> discard "other" from diagram
            </div>

            <div class="form_row">
                <input type="submit" />
            </div>
        </form>


        <?php 
validate_all_variables();
global $collation;
$collation = current_collation();
// make sure that all columns are different
if ($_GET["col1_type"] == $_GET["col2_type"] || $_GET["col2_type"] == $_GET["col3_type"] || $_GET["col1_type"] == $_GET["col3_type"]) {
    echo "all columns must be different";
    exit;
}
// get the full tweet count
$sql = "SELECT count(distinct(t.id)) as count FROM " . $esc['mysql']['dataset'] . "_tweets t ";
$sql .= sqlSubset();
$sqlresults = mysql_query($sql);
$data = mysql_fetch_assoc($sqlresults);
$fulltweetcount = $data["count"];
// process colums
getFlow($_GET["col1_type"], $_GET["col1_cutoff"], $_GET["col2_type"], $_GET["col2_cutoff"], $_GET["discard_other"], 0);
if ($_GET["col3_type"] != "none") {
    getFlow($_GET["col2_type"], $_GET["col2_cutoff"], $_GET["col3_type"], $_GET["col3_cutoff"], $_GET["discard_other"], 1);
开发者ID:jlorberkasunic,项目名称:dmi-tcat,代码行数:31,代码来源:mod.sankeymaker.php

示例2: printTopHashtags

function printTopHashtags()
{
    global $esc;
    $collation = current_collation();
    $results = array();
    $sql = "SELECT COUNT(hashtags.text COLLATE {$collation}) AS count, LOWER(hashtags.text COLLATE {$collation}) AS toget ";
    $sql .= "FROM " . $esc['mysql']['dataset'] . "_hashtags hashtags, " . $esc['mysql']['dataset'] . "_tweets t ";
    $sql .= sqlSubset("t.id = hashtags.tweet_id AND ");
    $sql .= " GROUP BY toget ORDER BY count DESC limit 10";
    //print $sql."<br>";
    $rec = mysql_query($sql);
    $out = "";
    while ($res = mysql_fetch_assoc($rec)) {
        $out .= $res['toget'] . " (" . $res['count'] . "), ";
    }
    print substr($out, 0, -2);
}
开发者ID:jlorberkasunic,项目名称:dmi-tcat,代码行数:17,代码来源:mod.hashtag_variability.php

示例3: generate

function generate($what, $filename)
{
    global $tsv, $network, $esc, $titles, $database, $interval, $outputformat;
    require_once __DIR__ . '/CSV.class.php';
    // initialize variables
    $tweets = $times = $from_user_names = $results = $urls = $urls_expanded = $hosts = $hashtags = array();
    $csv = new CSV($filename, $outputformat);
    $collation = current_collation();
    // determine interval
    $sql = "SELECT MIN(t.created_at) AS min, MAX(t.created_at) AS max FROM " . $esc['mysql']['dataset'] . "_tweets t ";
    $sql .= sqlSubset();
    //print $sql . "<bR>";
    $rec = mysql_query($sql);
    $res = mysql_fetch_assoc($rec);
    // get frequencies
    if ($what == "hashtag") {
        $results = frequencyTable("hashtags", "text");
    } elseif ($what == "urls") {
        $results = frequencyTable("urls", "url_followed");
    } elseif ($what == "hosts") {
        $results = frequencyTable("urls", "domain");
    } elseif ($what == "mention") {
        $results = frequencyTable("mentions", "to_user");
        // get other things
    } else {
        // @todo, this could also use database grouping
        $sql = "SELECT id,text COLLATE {$collation} as text,created_at,from_user_name COLLATE {$collation} as from_user_name FROM " . $esc['mysql']['dataset'] . "_tweets t ";
        $sql .= sqlSubset();
        // get slice and its min and max time
        $rec = mysql_query($sql);
        if ($rec && mysql_num_rows($rec) > 0) {
            while ($res = mysql_fetch_assoc($rec)) {
                $tweets[] = $res['text'];
                $ids[] = $res['id'];
                $times[] = $res['created_at'];
                $from_user_names[] = strtolower($res['from_user_name']);
            }
        }
        // extract desired things ($what) and group per interval
        foreach ($tweets as $key => $tweet) {
            $time = $times[$key];
            switch ($interval) {
                case "hourly":
                    $group = strftime("%Y-%m-%d %Hh", strtotime($time));
                    break;
                case "weekly":
                    $group = strftime("%Y %u", strtotime($time));
                    break;
                case "monthly":
                    $group = strftime("%Y-%m", strtotime($time));
                    break;
                case "yearly":
                    $group = strftime("%Y-%m", strtotime($time));
                    break;
                case "overall":
                    $group = "overall";
                    break;
                case "custom":
                    $group = groupByInterval(strftime("%Y-%m-%d", strtotime($time)));
                    break;
                default:
                    $group = strftime("%Y-%m-%d", strtotime($time));
                    // default daily
            }
            switch ($what) {
                //case "hashtag":
                //    foreach ($hashtags as $hashtag)
                //        $results[$group][] = $hashtag;
                //    break;
                //case "mention": // @todo, mentions might be taken from own table
                //    $stuff = get_replies($tweet);
                //    foreach ($stuff as $thing)
                //        $results[$group][] = $thing;
                //    break;
                case "user":
                    $results[$group][] = $from_user_names[$key];
                    break;
                case "user-mention":
                    $stuff = get_replies($tweet);
                    foreach ($stuff as $thing) {
                        $results[$group]['mentions'][] = $thing;
                    }
                    $results[$group]['users'][] = $from_user_names[$key];
                    //var_dump($results);
                    break;
                case "retweet":
                    $results[$group][] = $tweet;
                    // TODO, write stemming function
                    break;
                    //case "urls":
                    //    if (isset($urls_expanded[$ids[$key]]))
                    //        $results[$group][] = $urls_expanded[$ids[$key]];
                    //    break;
                    //case "hosts":
                    //    if (isset($urls_expanded[$ids[$key]]))
                    //        $results[$group][] = $hosts[$ids[$key]];
                    //    break;
                //case "urls":
                //    if (isset($urls_expanded[$ids[$key]]))
                //        $results[$group][] = $urls_expanded[$ids[$key]];
//.........这里部分代码省略.........
开发者ID:pwikstrom,项目名称:dmi-tcat,代码行数:101,代码来源:functions.php

示例4: printTopHashtags

function printTopHashtags()
{
    global $esc, $method;
    $collation = current_collation();
    $sql_interval = "DATE_FORMAT(t.created_at,'%Y-%m-%d') datepart ";
    if ($method == "word") {
        $sql = "SELECT COUNT(h.text COLLATE {$collation}) AS count, h.text COLLATE {$collation} AS toget, ";
        $sql .= $sql_interval;
        $sql .= "FROM " . $esc['mysql']['dataset'] . "_pos h, " . $esc['mysql']['dataset'] . "_tweets t ";
        $where = "t.id = h.tweet_id AND ";
        $sql .= sqlSubset($where);
        $sql .= " GROUP BY toget ORDER BY count DESC limit 10";
    } else {
        $sql = "SELECT COUNT(hashtags.text COLLATE {$collation}) AS count, LOWER(hashtags.text COLLATE {$collation}) AS toget, ";
        $sql .= $sql_interval;
        $sql .= "FROM " . $esc['mysql']['dataset'] . "_hashtags hashtags, " . $esc['mysql']['dataset'] . "_tweets t ";
        $where = "t.id = hashtags.tweet_id AND ";
        $sql .= sqlSubset($where);
        $sql .= " GROUP BY toget ORDER BY count DESC limit 10";
    }
    //print $sql . "<br>"; flush();
    $rec = mysql_query($sql);
    $out = "";
    while ($res = mysql_fetch_assoc($rec)) {
        //if ($res['count'] > $esc['shell']['minf'])
        $out .= $res['toget'] . " (" . $res['count'] . "), ";
    }
    print substr($out, 0, -2);
}
开发者ID:jlorberkasunic,项目名称:dmi-tcat,代码行数:29,代码来源:mod.word_variability.php


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