View source
<?php
function _views_create_handler($definition, $type = 'handler') {
if (empty($definition['handler'])) {
return;
}
if (!class_exists($definition['handler']) && !views_include_handler($definition, $type)) {
return;
}
$handler = new $definition['handler']();
$handler
->set_definition($definition);
$handler
->construct();
return $handler;
}
function views_include_handler($definition, $type, $count = 0) {
if (isset($definition['handler']) && class_exists($definition['handler'])) {
return TRUE;
}
if ($count > 10) {
vpr(t('Handler @handler include tried to loop infinitely!', array(
'@handler' => $definition['handler'],
)));
return FALSE;
}
if (!isset($definition['path'])) {
if ($type == 'handler') {
$definition += views_fetch_handler_data($definition['handler']);
}
else {
$definition += views_fetch_plugin_data($type, $definition['handler']);
}
}
if (!empty($definition['parent'])) {
if ($type == 'handler') {
$parent = views_fetch_handler_data($definition['parent']);
}
else {
$parent = views_fetch_plugin_data($type, $definition['parent']);
}
if ($parent) {
$rc = views_include_handler($parent, $type, $count + 1);
if (!$rc) {
return FALSE;
}
}
}
if (isset($definition['path']) && $definition['file']) {
$filename = './' . $definition['path'] . '/' . $definition['file'];
if (file_exists($filename)) {
require_once $filename;
}
}
return class_exists($definition['handler']);
}
function _views_prepare_handler($definition, $data, $field) {
foreach (array(
'group',
'title',
'title short',
'help',
'real field',
) as $key) {
if (!isset($definition[$key])) {
if (!empty($data[$field][$key])) {
$definition[$key] = $data[$field][$key];
}
else {
if (!empty($data['table'][$key])) {
$definition[$key] = $data['table'][$key];
}
}
}
}
return _views_create_handler($definition);
}
function views_fetch_handler_data($handler = NULL) {
static $cache = NULL;
if (!isset($cache)) {
$start = views_microtime();
$cache = views_discover_handlers();
vpr('Views handlers build time: ' . (views_microtime() - $start) * 1000 . ' ms');
}
if (!$handler) {
return $cache;
}
else {
if (isset($cache[$handler])) {
return $cache[$handler];
}
}
return array();
}
function views_discover_handlers() {
$cache = array();
foreach (module_implements('views_handlers') as $module) {
$function = $module . '_views_handlers';
$result = $function();
if (!is_array($result)) {
continue;
}
$module_dir = isset($result['info']['module']) ? $result['info']['module'] : $module;
$path = isset($result['info']['path']) ? $result['info']['path'] : drupal_get_path('module', $module_dir);
foreach ($result['handlers'] as $handler => $def) {
if (!isset($def['module'])) {
$def['module'] = $module_dir;
}
if (!isset($def['path'])) {
$def['path'] = $path;
}
if (!isset($def['file'])) {
$def['file'] = "{$handler}.inc";
}
if (!isset($def['handler'])) {
$def['handler'] = $handler;
}
$cache[$handler] = $def;
}
}
return $cache;
}
function views_get_table_join($table, $base_table) {
$data = views_fetch_data($table);
if (isset($data['table']['join'][$base_table])) {
$h = $data['table']['join'][$base_table];
if (!empty($h['handler']) && class_exists($h['handler'])) {
$handler = new $h['handler']();
}
else {
$handler = new views_join();
}
$handler->definition = $h;
if (empty($handler->definition['table'])) {
$handler->definition['table'] = $table;
}
if (empty($handler->definition['left_table'])) {
$handler->definition['left_table'] = $base_table;
}
if (isset($h['arguments'])) {
call_user_func_array(array(
&$handler,
'construct',
), $h['arguments']);
}
else {
$handler
->construct();
}
return $handler;
}
vpr("Missing join: {$table} {$base_table}");
}
class views_handler extends views_object {
function init(&$view, $options) {
$this->view =& $view;
$this
->unpack_options($this->options, $options);
if (isset($options['table'])) {
$this->table = $options['table'];
}
if (isset($this->definition['real field'])) {
$this->real_field = $this->definition['real field'];
}
if (isset($this->definition['field'])) {
$this->real_field = $this->definition['field'];
}
if (isset($options['field'])) {
$this->field = $options['field'];
if (!isset($this->real_field)) {
$this->real_field = $options['field'];
}
}
$this->query =& $view->query;
}
function ui_name($short = FALSE) {
$title = $short && isset($this->definition['title short']) ? $this->definition['title short'] : $this->definition['title'];
return t('!group: !title', array(
'!group' => $this->definition['group'],
'!title' => $title,
));
}
function options_form(&$form, &$form_state) {
}
function options_validate($form, &$form_state) {
}
function options_submit($form, &$form_state) {
}
function has_extra_options() {
return FALSE;
}
function extra_options(&$option) {
}
function extra_options_form(&$form, &$form_state) {
}
function extra_options_validate($form, &$form_state) {
}
function extra_options_submit($form, &$form_state) {
}
function expose_options() {
}
function exposed_form(&$form, &$form_state) {
}
function exposed_validate(&$form, &$form_state) {
}
function exposed_submit(&$form, &$form_state) {
}
function exposed_info() {
}
function can_expose() {
return FALSE;
}
function access() {
if (isset($this->definition['access callback']) && function_exists($this->definition['access callback'])) {
if (isset($this->definition['access arguments']) && is_array($this->definition['access arguments'])) {
return call_user_func_array($this->definition['access callback'], $this->definition['access arguments']);
}
return $this->definition['access callback']();
}
return TRUE;
}
function pre_query() {
}
function set_relationship() {
$this->relationship = NULL;
if (empty($this->options['relationship']) || $this->options['relationship'] == 'none') {
return;
}
$relationship = $this->options['relationship'];
if (empty($this->view->relationship[$relationship])) {
return;
}
if (empty($this->view->relationship[$relationship]->alias)) {
return;
}
$this->relationship = $this->view->relationship[$relationship]->alias;
}
function query() {
}
function ensure_my_table() {
if (!isset($this->table_alias)) {
$this->table_alias = $this->query
->ensure_table($this->table, $this->relationship);
}
return $this->table_alias;
}
function admin_summary() {
}
function needs_style_plugin() {
return FALSE;
}
function is_exposed() {
return !empty($this->options['exposed']);
}
function accept_exposed_input($input) {
return TRUE;
}
function store_exposed_input($input, $status) {
return TRUE;
}
function get_join() {
if (empty($this->query->relationships[$this->relationship])) {
$base_table = $this->query->base_table;
}
else {
$base_table = $this->query->relationships[$this->relationship]['base'];
}
$join = views_get_table_join($this->table, $base_table);
if ($join) {
return drupal_clone($join);
}
}
function validate() {
return array();
}
function broken() {
}
}
class views_many_to_one_helper {
function views_many_to_one_helper(&$handler) {
$this->handler =& $handler;
}
public static function option_definition(&$options) {
$options['reduce_duplicates'] = array(
'default' => FALSE,
);
}
function options_form(&$form, &$form_state) {
$form['reduce_duplicates'] = array(
'#type' => 'checkbox',
'#title' => t('Reduce duplicates'),
'#description' => t('This filter can cause items that have more than one of the selected options to appear as duplicate results. If this filter causes duplicate results to occur, this checkbox can reduce those duplicates; however, the more terms it has to search for, the less performant the query will be, so use this with caution. Shouldn\'t be set on single-value fields, as it may cause values to disappear from display, if used on an incompatible field.'),
'#default_value' => !empty($this->handler->options['reduce_duplicates']),
);
}
function get_field() {
if (!empty($this->formula)) {
return $this->handler
->get_formula();
}
else {
return $this->handler->table_alias . '.' . $this->handler->real_field;
}
}
function add_table($join = NULL, $alias = NULL) {
$field = $this->handler->table . '.' . $this->handler->field;
if (empty($join)) {
$join = $this
->get_join();
}
$relationship = $this->handler->relationship;
if (empty($this->handler->query->relationships[$relationship])) {
$base_table = $this->handler->query->base_table;
}
else {
$base_table = $this->handler->query->relationships[$relationship]['base'];
}
$r_join = drupal_clone($join);
while ($r_join->left_table != $base_table) {
$r_join = views_get_table_join($r_join->left_table, $base_table);
}
if ($r_join->table != $join->table) {
$relationship = $this->handler->query
->add_relationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship);
}
$alias = $this->handler->query
->add_table($this->handler->table, $relationship, $join, $alias);
if (empty($this->handler->view->many_to_one_tables[$field])) {
$this->handler->view->many_to_one_tables[$field] = $this->handler->value;
}
else {
$this->handler->view->many_to_one_tables[$field] = array_merge($this->handler->view->many_to_one_tables[$field], $this->handler->value);
}
return $alias;
}
function get_join() {
return $this->handler
->get_join();
}
function summary_join() {
$field = $this->handler->table . '.' . $this->handler->field;
$join = $this
->get_join();
$options = $this->handler->options;
$view =& $this->handler->view;
$query =& $this->handler->query;
if (!empty($options['require_value'])) {
$join->type = 'INNER';
}
if (empty($options['add_table']) || empty($view->many_to_one_tables[$field])) {
return $query
->ensure_table($this->handler->table, $this->handler->relationship, $join);
}
else {
if (!empty($view->many_to_one_tables[$field])) {
foreach ($view->many_to_one_tables[$field] as $value) {
$join->extra = array(
array(
'field' => $this->handler->real_field,
'operator' => '!=',
'value' => $value,
'numeric' => !empty($this->definition['numeric']),
),
);
}
}
return $this
->add_table($join);
}
}
function ensure_my_table() {
if (!isset($this->handler->table_alias)) {
$field = $this->handler->table . '.' . $this->handler->field;
if ($this->handler->operator == 'or' && empty($this->handler->options['reduce_duplicates'])) {
if (empty($this->handler->options['add_table']) && empty($this->handler->view->many_to_one_tables[$field])) {
$join = $this
->get_join();
$join->type = 'INNER';
$this->handler->table_alias = $this->handler->query
->ensure_table($this->handler->table, $this->handler->relationship, $join);
$this->handler->view->many_to_one_tables[$field] = $this->handler->value;
}
else {
$join = $this
->get_join();
$join->type = 'LEFT';
if (!empty($this->handler->view->many_to_one_tables[$field])) {
foreach ($this->handler->view->many_to_one_tables[$field] as $value) {
$join->extra = array(
array(
'field' => $this->handler->real_field,
'operator' => '!=',
'value' => $value,
'numeric' => !empty($this->handler->definition['numeric']),
),
);
}
}
$this->handler->table_alias = $this
->add_table($join);
}
return $this->handler->table_alias;
}
if ($this->handler->operator != 'not') {
$this->handler->table_aliases = array();
foreach ($this->handler->value as $value) {
$join = $this
->get_join();
if ($this->handler->operator == 'and') {
$join->type = 'INNER';
}
$join->extra = array(
array(
'field' => $this->handler->real_field,
'value' => $value,
'numeric' => !empty($this->handler->definition['numeric']),
),
);
if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) {
if (!isset($this->handler->view->many_to_one_count[$this->handler->table])) {
$this->handler->view->many_to_one_count[$this->handler->table] = 0;
}
$this->handler->view->many_to_one_aliases[$field][$value] = $this->handler->table . '_value_' . $this->handler->view->many_to_one_count[$this->handler->table]++;
}
$alias = $this->handler->table_aliases[$value] = $this
->add_table($join, $this->handler->view->many_to_one_aliases[$field][$value]);
if (empty($this->handler->table_alias)) {
$this->handler->table_alias = $alias;
}
}
}
else {
$join = $this
->get_join();
$join->type = 'LEFT';
$join->extra = array();
$join->extra_type = 'OR';
foreach ($this->handler->value as $value) {
$join->extra[] = array(
'field' => $this->handler->real_field,
'value' => $value,
'numeric' => !empty($this->handler->definition['numeric']),
);
}
$this->handler->table_alias = $this
->add_table($join);
}
}
return $this->handler->table_alias;
}
function add_filter() {
if (empty($this->handler->value)) {
return;
}
$this->handler
->ensure_my_table();
$field = $this
->get_field();
$options = $this->handler->options;
$operator = $this->handler->operator;
if (empty($options['group'])) {
$options['group'] = 0;
}
$placeholder = !empty($this->handler->definition['numeric']) ? '%d' : "'%s'";
if ($operator == 'not') {
$this->handler->query
->add_where($options['group'], "{$field} IS NULL");
}
else {
if ($operator == 'or' && empty($options['reduce_duplicates'])) {
if (count($this->handler->value) > 1) {
$replace = array_fill(0, sizeof($this->handler->value), $placeholder);
$in = '(' . implode(", ", $replace) . ')';
$this->handler->query
->add_where($options['group'], "{$field} IN {$in}", $this->handler->value);
}
else {
$this->handler->query
->add_where($options['group'], "{$field} = {$placeholder}", $this->handler->value);
}
}
else {
$field = $this->handler->real_field;
$clauses = array();
foreach ($this->handler->table_aliases as $value => $alias) {
$clauses[] = "{$alias}.{$field} = {$placeholder}";
}
$group = empty($options['group']) ? 0 : $options['group'];
$this->handler->query
->add_where($group, implode(' ' . strtoupper($operator) . ' ', $clauses), $this->handler->value);
}
}
}
}
function views_break_phrase($str, &$filter) {
if (!$filter) {
$filter = new stdClass();
}
if (!isset($filter->value)) {
$filter->value = array();
}
if (!isset($filter->operator)) {
$filter->operator = 'or';
}
if ($str == '') {
return $filter;
}
if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str)) {
$filter->operator = 'or';
$filter->value = preg_split('/[+ ]/', $str);
}
else {
if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) {
$filter->operator = 'and';
$filter->value = explode(',', $str);
}
}
if (!empty($str) && (empty($filter->value) || !is_array($filter->value))) {
$filter->value = array(
-1,
);
return $filter;
}
foreach ($filter->value as $id => $value) {
$filter->value[$id] = intval($value);
}
return $filter;
}
function views_get_timezone() {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
}
else {
$timezone = variable_get('date_default_timezone', 0);
}
if (in_array($GLOBALS['db_type'], array(
'mysql',
'mysqli',
'pgsql',
))) {
$offset = '+00:00';
static $already_set = false;
if (!$already_set) {
if ($GLOBALS['db_type'] == 'pgsql') {
db_query("SET TIME ZONE INTERVAL '{$offset}' HOUR TO MINUTE");
}
elseif ($GLOBALS['db_type'] == 'mysqli') {
db_query("SET @@session.time_zone = '{$offset}'");
}
elseif ($GLOBALS['db_type'] == 'mysql' && version_compare(db_version(), '4.1.3', '>=')) {
db_query("SET @@session.time_zone = '{$offset}'");
}
$already_set = true;
}
}
return $timezone;
}
function views_date_sql_field($field, $field_type = 'int', $set_offset = NULL) {
$db_type = $GLOBALS['db_type'];
$offset = $set_offset !== NULL ? $set_offset : views_get_timezone();
switch ($db_type) {
case 'mysql':
case 'mysqli':
switch ($field_type) {
case 'int':
$field = "FROM_UNIXTIME({$field})";
break;
case 'datetime':
break;
}
if (!empty($offset)) {
$field = "({$field} + INTERVAL {$offset} SECOND)";
}
return $field;
case 'pgsql':
switch ($field_type) {
case 'int':
$field = "{$field}::ABSTIME";
break;
case 'datetime':
break;
}
if (!empty($offset)) {
$field = "({$field} + INTERVAL '{$offset} SECONDS')";
}
return $field;
}
}
function views_date_sql_format($format, $field, $field_type = 'int', $set_offset = NULL) {
$db_type = $GLOBALS['db_type'];
$field = views_date_sql_field($field, $field_type, $set_offset);
switch ($db_type) {
case 'mysql':
case 'mysqli':
$replace = array(
'Y' => '%Y',
'y' => '%y',
'M' => '%%b',
'm' => '%m',
'n' => '%c',
'F' => '%M',
'D' => '%a',
'd' => '%%d',
'l' => '%W',
'j' => '%e',
'W' => '%v',
'H' => '%H',
'h' => '%h',
'i' => '%i',
's' => '%%s',
'A' => '%p',
);
$format = strtr($format, $replace);
return "DATE_FORMAT({$field}, '{$format}')";
case 'pgsql':
$replace = array(
'Y' => 'YYYY',
'y' => 'YY',
'M' => 'Mon',
'm' => 'MM',
'n' => 'MM',
'F' => 'Month',
'D' => 'Dy',
'd' => 'DD',
'l' => 'Day',
'j' => 'DD',
'W' => 'WW',
'H' => 'HH24',
'h' => 'HH12',
'i' => 'MI',
's' => 'SS',
'A' => 'AM',
);
$format = strtr($format, $replace);
return "TO_CHAR({$field}, '{$format}')";
}
}
function views_date_sql_extract($extract_type, $field, $field_type = 'int', $set_offset = NULL) {
$db_type = $GLOBALS['db_type'];
$field = views_date_sql_field($field, $field_type, $set_offset);
switch ($extract_type) {
case 'DATE':
return $field;
case 'YEAR':
return "EXTRACT(YEAR FROM({$field}))";
case 'MONTH':
return "EXTRACT(MONTH FROM({$field}))";
case 'DAY':
return "EXTRACT(DAY FROM({$field}))";
case 'HOUR':
return "EXTRACT(HOUR FROM({$field}))";
case 'MINUTE':
return "EXTRACT(MINUTE FROM({$field}))";
case 'SECOND':
return "EXTRACT(SECOND FROM({$field}))";
case 'WEEK':
switch ($db_type) {
case 'mysql':
case 'mysqli':
return "WEEK({$field}, 3)";
case 'pgsql':
return "EXTRACT(WEEK FROM({$field}))";
}
case 'DOW':
switch ($db_type) {
case 'mysql':
case 'mysqli':
return "INTEGER(DAYOFWEEK({$field}) - 1)";
case 'pgsql':
return "EXTRACT(DOW FROM({$field}))";
}
case 'DOY':
switch ($db_type) {
case 'mysql':
case 'mysqli':
return "DAYOFYEAR({$field})";
case 'pgsql':
return "EXTRACT(DOY FROM({$field}))";
}
}
}
function views_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'views') . '/handlers',
),
'handlers' => array(
'views_handler_argument' => array(
'parent' => 'views_handler',
),
'views_handler_argument_numeric' => array(
'parent' => 'views_handler_argument',
),
'views_handler_argument_formula' => array(
'parent' => 'views_handler_argument',
),
'views_handler_argument_date' => array(
'parent' => 'views_handler_argument_formula',
),
'views_handler_argument_string' => array(
'parent' => 'views_handler_argument',
),
'views_handler_argument_many_to_one' => array(
'parent' => 'views_handler_argument',
),
'views_handler_argument_null' => array(
'parent' => 'views_handler_argument',
),
'views_handler_argument_broken' => array(
'parent' => 'views_handler_argument',
),
'views_handler_field' => array(
'parent' => 'views_handler',
),
'views_handler_field_date' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_boolean' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_markup' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_xss' => array(
'parent' => 'views_handler_field',
'file' => 'views_handler_field.inc',
),
'views_handler_field_url' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_file_size' => array(
'parent' => 'views_handler_field',
'file' => 'views_handler_field.inc',
),
'views_handler_field_prerender_list' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_numeric' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_custom' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_counter' => array(
'parent' => 'views_handler_field',
),
'views_handler_field_math' => array(
'parent' => 'views_handler_field_numeric',
),
'views_handler_field_broken' => array(
'parent' => 'views_handler_field',
),
'views_handler_filter' => array(
'parent' => 'views_handler',
),
'views_handler_filter_equality' => array(
'parent' => 'views_handler_filter',
),
'views_handler_filter_string' => array(
'parent' => 'views_handler_filter',
),
'views_handler_filter_boolean_operator' => array(
'parent' => 'views_handler_filter',
),
'views_handler_filter_boolean_operator_string' => array(
'parent' => 'views_handler_filter_boolean_operator',
),
'views_handler_filter_in_operator' => array(
'parent' => 'views_handler_filter',
),
'views_handler_filter_numeric' => array(
'parent' => 'views_handler_filter',
),
'views_handler_filter_float' => array(
'parent' => 'views_handler_filter_numeric',
),
'views_handler_filter_date' => array(
'parent' => 'views_handler_filter_numeric',
),
'views_handler_filter_many_to_one' => array(
'parent' => 'views_handler_filter_in_operator',
),
'views_handler_filter_broken' => array(
'parent' => 'views_handler_filter',
),
'views_handler_relationship' => array(
'parent' => 'views_handler',
),
'views_handler_relationship_broken' => array(
'parent' => 'views_handler_relationship',
),
'views_handler_sort' => array(
'parent' => 'views_handler',
),
'views_handler_sort_formula' => array(
'parent' => 'views_handler_sort',
),
'views_handler_sort_date' => array(
'parent' => 'views_handler_sort',
),
'views_handler_sort_menu_hierarchy' => array(
'parent' => 'views_handler_sort',
),
'views_handler_sort_random' => array(
'parent' => 'views_handler_sort',
),
'views_handler_sort_broken' => array(
'parent' => 'views_handler_sort',
),
),
);
}
class views_join {
function construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT') {
$this->extra_type = 'AND';
if (!empty($table)) {
$this->table = $table;
$this->left_table = $left_table;
$this->left_field = $left_field;
$this->field = $field;
$this->extra = $extra;
$this->type = strtoupper($type);
}
else {
if (!empty($this->definition)) {
$this->table = $this->definition['table'];
$this->left_table = $this->definition['left_table'];
$this->left_field = $this->definition['left_field'];
$this->field = $this->definition['field'];
if (!empty($this->definition['extra'])) {
$this->extra = $this->definition['extra'];
}
if (!empty($this->definition['extra type'])) {
$this->extra_type = strtoupper($this->definition['extra type']);
}
$this->type = !empty($this->definition['type']) ? strtoupper($this->definition['type']) : 'LEFT';
}
}
}
function join($table, &$query) {
if (empty($this->definition['table formula'])) {
$right_table = "{" . $this->table . "}";
}
else {
$right_table = $this->definition['table formula'];
}
if ($this->left_table) {
$left = $query
->get_table_info($this->left_table);
$left_field = "{$left['alias']}.{$this->left_field}";
}
else {
$left_field = $this->left_field;
}
$output = " {$this->type} JOIN {$right_table} {$table['alias']} ON {$left_field} = {$table['alias']}.{$this->field}";
$view = views_get_current_view();
$replacements = array();
if (!empty($view)) {
$replacements = $view
->substitutions();
}
else {
vpr('The current view is not set, maybe some code missed to execute $view->pre_execute()');
}
if (isset($this->extra)) {
if (is_array($this->extra)) {
$extras = array();
foreach ($this->extra as $info) {
$extra = '';
$join_table = '';
if (!array_key_exists('table', $info)) {
$join_table = $table['alias'] . '.';
}
elseif (isset($info['table'])) {
$join_table = $info['table'] . '.';
}
$info['value'] = str_replace(array_keys($replacements), $replacements, $info['value']);
if (empty($info['raw'])) {
$raw_value = $this
->db_safe($info['value'], $info);
$q = empty($info['numeric']) ? "'" : '';
}
else {
$raw_value = $info['value'];
$q = '';
}
if (is_array($raw_value)) {
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
if (count($raw_value) == 1) {
$value = $q . array_shift($raw_value) . $q;
$operator = $operator == 'NOT IN' ? '!=' : '=';
}
else {
$value = "({$q}" . implode("{$q}, {$q}", $raw_value) . "{$q})";
}
}
else {
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$value = "{$q}{$raw_value}{$q}";
}
$extras[] = "{$join_table}{$info['field']} {$operator} {$value}";
}
if ($extras) {
if (count($extras) == 1) {
$output .= ' AND ' . array_shift($extras);
}
else {
$output .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
}
}
}
else {
if ($this->extra && is_string($this->extra)) {
$output .= " AND ({$this->extra})";
}
}
}
return $output;
}
function db_safe($input, $info) {
if (is_array($input)) {
$output = array();
foreach ($input as $value) {
if (empty($info['numeric'])) {
$output[] = db_escape_string($value);
}
else {
$output[] = intval($value);
}
}
}
else {
if (empty($info['numeric'])) {
$output = db_escape_string($input);
}
else {
$output = intval($input);
}
}
return $output;
}
}
function views_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'views') . '/modules',
);
}
if (!function_exists('aggregator_views_api')) {
function aggregator_views_api() {
return views_views_api();
}
}
if (!function_exists('book_views_api')) {
function book_views_api() {
return views_views_api();
}
}
if (!function_exists('comment_views_api')) {
function comment_views_api() {
return views_views_api();
}
}
if (!function_exists('locale_views_api')) {
function locale_views_api() {
return views_views_api();
}
}
if (!function_exists('filter_views_api')) {
function filter_views_api() {
return views_views_api();
}
}
if (!function_exists('node_views_api')) {
function node_views_api() {
return views_views_api();
}
}
if (!function_exists('poll_views_api')) {
function poll_views_api() {
return views_views_api();
}
}
if (!function_exists('profile_views_api')) {
function profile_views_api() {
return views_views_api();
}
}
if (!function_exists('search_views_api')) {
function search_views_api() {
return views_views_api();
}
}
if (!function_exists('statistics_views_api')) {
function statistics_views_api() {
return views_views_api();
}
}
if (!function_exists('system_views_api')) {
function system_views_api() {
return views_views_api();
}
}
if (!function_exists('taxonomy_views_api')) {
function taxonomy_views_api() {
return views_views_api();
}
}
if (!function_exists('translation_views_api')) {
function translation_views_api() {
return views_views_api();
}
}
if (!function_exists('upload_views_api')) {
function upload_views_api() {
return views_views_api();
}
}
if (!function_exists('user_views_api')) {
function user_views_api() {
return views_views_api();
}
}
if (!function_exists('contact_views_api')) {
function contact_views_api() {
return views_views_api();
}
}