本文整理汇总了PHP中OA_Dal_Delivery_getKeywordCondition函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_getKeywordCondition函数的具体用法?PHP OA_Dal_Delivery_getKeywordCondition怎么用?PHP OA_Dal_Delivery_getKeywordCondition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_getKeywordCondition函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OA_Dal_Delivery_buildAdInfoQuery
//.........这里部分代码省略.........
// Only upper limit, set lower limit to make sure not text ads are delivered
$min = 1;
}
if (!$max) {
// Only lower limit
if ($operator == 'OR') {
$conditions .= "OR d.height >= {$min} ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.height >= {$min} ";
} else {
$conditions .= "AND d.height < {$min} ";
}
} else {
// Both lower and upper limit
if ($operator == 'OR') {
$conditions .= "OR (d.height >= {$min} AND d.height <= {$max}) ";
} elseif ($operator == 'AND') {
$conditions .= "AND (d.height >= {$min} AND d.height <= {$max}) ";
} else {
$conditions .= "AND (d.height < {$min} OR d.height > {$max}) ";
}
}
}
$onlykeywords = false;
} elseif (preg_match('#^(?:(?:bannerid|adid|ad_id):)?(\\d+)$#', $part_array[$k], $m)) {
$bannerid = (int) $m[1];
if ($bannerid) {
if ($operator == 'OR') {
$conditions .= "OR d.bannerid = {$bannerid} ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.bannerid = {$bannerid} ";
} else {
$conditions .= "AND d.bannerid <> {$bannerid} ";
}
}
$onlykeywords = false;
} elseif (preg_match('#^(?:(?:clientid|campaignid|placementid|placement_id):)?(\\d+)$#', $part_array[$k], $m)) {
$campaignid = (int) $m[1];
if ($campaignid) {
if ($operator == 'OR') {
$conditions .= "OR d.campaignid = {$campaignid} ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.campaignid = {$campaignid} ";
} else {
$conditions .= "AND d.campaignid <> {$campaignid} ";
}
}
$onlykeywords = false;
} elseif (substr($part_array[$k], 0, 7) == 'format:') {
$format = OX_escapeString(trim(stripslashes(substr($part_array[$k], 7))));
if (!empty($format)) {
if ($operator == 'OR') {
$conditions .= "OR d.contenttype = '{$format}' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.contenttype = '{$format}' ";
} else {
$conditions .= "AND d.contenttype <> '{$format}' ";
}
}
$onlykeywords = false;
} elseif ($part_array[$k] == 'html') {
if ($operator == 'OR') {
$conditions .= "OR d.storagetype = 'html' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.storagetype = 'html' ";
} else {
$conditions .= "AND d.storagetype <> 'html' ";
}
$onlykeywords = false;
} elseif ($part_array[$k] == 'textad') {
if ($operator == 'OR') {
$conditions .= "OR d.storagetype = 'txt' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.storagetype = 'txt' ";
} else {
$conditions .= "AND d.storagetype <> 'txt' ";
}
$onlykeywords = false;
} else {
$conditions .= OA_Dal_Delivery_getKeywordCondition($operator, $part_array[$k]);
}
}
}
// Strip first AND or OR from $conditions
$conditions = strstr($conditions, ' ');
// Add global keyword
if ($lastpart == true && $onlykeywords == true) {
$conditions .= OA_Dal_Delivery_getKeywordCondition('OR', 'global');
}
// Add conditions to select
if ($conditions != '') {
$select .= ' AND (' . $conditions . ') ';
}
}
$columns = implode(",\n ", $aColumns);
$tables = implode("\n ", $aTables);
$leftJoin = "\n LEFT JOIN " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['campaigns_trackers']) . " AS ct ON (ct.campaignid = m.campaignid)\n LEFT JOIN " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['clients']) . " AS cl ON (cl.clientid = m.clientid)\n LEFT JOIN " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['agency']) . " AS a ON (a.agencyid = cl.agencyid)\n ";
$query = "SELECT\n " . $columns . "\nFROM\n " . $tables . $leftJoin . "\nWHERE " . $select;
return $query;
}
示例2: OA_Dal_Delivery_buildQuery
//.........这里部分代码省略.........
}
}
// Both lower and upper limit
if ($max != '') {
if ($operator == 'OR') {
$conditions .= "OR (d.height >= '" . trim($min) . "' AND d.height <= '" . trim($max) . "') ";
} elseif ($operator == 'AND') {
$conditions .= "AND (d.height >= '" . trim($min) . "' AND d.height <= '" . trim($max) . "') ";
} else {
$conditions .= "AND (d.height < '" . trim($min) . "' OR d.height > '" . trim($max) . "') ";
}
}
} else {
// Single value
if ($operator == 'OR') {
$conditions .= "OR d.height = '" . trim($part_array[$k]) . "' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.height = '" . trim($part_array[$k]) . "' ";
} else {
$conditions .= "AND d.height != '" . trim($part_array[$k]) . "' ";
}
}
}
$onlykeywords = false;
} elseif (preg_match('#^(?:(?:bannerid|adid|ad_id):)?([0-9]+)$#', $part_array[$k], $m)) {
$part_array[$k] = $m[1];
if ($part_array[$k]) {
if ($operator == 'OR') {
$conditions .= "OR d.bannerid='" . $part_array[$k] . "' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.bannerid='" . $part_array[$k] . "' ";
} else {
$conditions .= "AND d.bannerid!='" . $part_array[$k] . "' ";
}
}
$onlykeywords = false;
} elseif (preg_match('#^(?:(?:clientid|campaignid|placementid|placement_id):)?([0-9]+)$#', $part_array[$k], $m)) {
$part_array[$k] = $m[1];
if ($part_array[$k]) {
if ($operator == 'OR') {
$conditions .= "OR d.campaignid='" . trim($part_array[$k]) . "' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.campaignid='" . trim($part_array[$k]) . "' ";
} else {
$conditions .= "AND d.campaignid!='" . trim($part_array[$k]) . "' ";
}
}
$onlykeywords = false;
} elseif (substr($part_array[$k], 0, 7) == 'format:') {
$part_array[$k] = substr($part_array[$k], 7);
if ($part_array[$k] != '' && $part_array[$k] != ' ') {
if ($operator == 'OR') {
$conditions .= "OR d.contenttype='" . trim($part_array[$k]) . "' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.contenttype='" . trim($part_array[$k]) . "' ";
} else {
$conditions .= "AND d.contenttype!='" . trim($part_array[$k]) . "' ";
}
}
$onlykeywords = false;
} elseif ($part_array[$k] == 'html') {
if ($operator == 'OR') {
$conditions .= "OR d.storagetype='html' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.storagetype='html' ";
} else {
$conditions .= "AND d.storagetype!='html' ";
}
$onlykeywords = false;
} elseif ($part_array[$k] == 'textad') {
if ($operator == 'OR') {
$conditions .= "OR d.storagetype='txt' ";
} elseif ($operator == 'AND') {
$conditions .= "AND d.storagetype='txt' ";
} else {
$conditions .= "AND d.storagetype!='txt' ";
}
$onlykeywords = false;
} else {
$conditions .= OA_Dal_Delivery_getKeywordCondition($operator, $part_array[$k]);
}
}
}
// Strip first AND or OR from $conditions
$conditions = strstr($conditions, ' ');
// Add global keyword
if ($lastpart == true && $onlykeywords == true) {
$conditions .= OA_Dal_Delivery_getKeywordCondition('OR', 'global');
}
// Add conditions to select
if ($conditions != '') {
$select .= ' AND (' . $conditions . ') ';
}
}
$columns = implode(",\n ", $aColumns);
$tables = implode("\n ", $aTables);
$leftJoin = "\nLEFT JOIN " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['clients']) . " AS c ON (c.clientid = m.clientid)\nLEFT JOIN " . OX_escapeIdentifier($conf['table']['prefix'] . $conf['table']['agency']) . " AS a ON (a.agencyid = c.agencyid)\n";
$query = "SELECT\n " . $columns . "\nFROM\n " . $tables . $leftJoin . "\nWHERE " . $select;
return $query;
}