本文整理匯總了PHP中PMA_filterTracking函數的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_filterTracking函數的具體用法?PHP PMA_filterTracking怎麽用?PHP PMA_filterTracking使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PMA_filterTracking函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testPMAFilterTracking
/**
* Tests for PMA_filterTracking() method.
*
* @return void
* @test
*/
public function testPMAFilterTracking()
{
$data = array(array("date" => "20120102", "username" => "username1", "statement" => "statement1"), array("date" => "20130102", "username" => "username2", "statement" => "statement2"));
$filter_ts_from = 0;
$filter_ts_to = 999999999999;
$filter_users = array("username1");
$ret = PMA_filterTracking($data, $filter_ts_from, $filter_ts_to, $filter_users);
$this->assertEquals('username1', $ret[0]['username']);
$this->assertEquals('statement1', $ret[0]['statement']);
}
示例2: PMA_getEntries
/**
* Function to get the entries
*
* @param array $data data
* @param int $filter_ts_from filter time stamp from
* @param int $filter_ts_to filter time stamp to
* @param array $filter_users filter users
*
* @return array
*/
function PMA_getEntries($data, $filter_ts_from, $filter_ts_to, $filter_users)
{
$entries = array();
// Filtering data definition statements
if ($_REQUEST['logtype'] == 'schema' || $_REQUEST['logtype'] == 'schema_and_data') {
$entries = array_merge($entries, PMA_filterTracking($data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users));
}
// Filtering data manipulation statements
if ($_REQUEST['logtype'] == 'data' || $_REQUEST['logtype'] == 'schema_and_data') {
$entries = array_merge($entries, PMA_filterTracking($data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users));
}
// Sort it
$ids = $timestamps = $usernames = $statements = array();
foreach ($entries as $key => $row) {
$ids[$key] = $row['id'];
$timestamps[$key] = $row['timestamp'];
$usernames[$key] = $row['username'];
$statements[$key] = $row['statement'];
}
array_multisort($timestamps, SORT_ASC, $ids, SORT_ASC, $usernames, SORT_ASC, $statements, SORT_ASC, $entries);
return $entries;
}