bidder.inc in Doubleclick for Publishers (DFP) 7.2
File
prebid/includes/bidder.incView source
<?php
/**
* @file bidder.inc
*
*/
/**
* Process function for the bidder plugin type.
*
* @param \stdClass $plugin
* @param array $info
*/
function prebid_bidder_process(&$plugin, $info) {
$name = isset($plugin['name']) ? $plugin['name'] : ucwords(str_replace('_', ' ', $plugin['name']));
$plugin += array(
'name' => $name,
'params' => array(),
'timeout' => 1500,
'buckets' => array(),
'handler' => FALSE,
'tags' => array(),
'multiple' => FALSE,
);
}
/**
* Creates a default pricing bucket.
*
* @return array
* Pricing Granularity for prebid.
*/
function prebid_get_price_granularity() {
$buckets = array(
array(
'precision' => 2,
'min' => 0,
'max' => 1000,
'increment' => 0.01,
),
);
// Allow other modules to modify/add pricing buckets.
drupal_alter('prebid_price_granularity_buckets', $buckets);
return $buckets;
}
/**
* Settings used in js with an alter.
*
* @return array
* Global setting used in js.
*/
function prebid_get_global_settings() {
$settings = array(
'timeout' => 1500,
);
// Allow other modules to modify/add global settings.
drupal_alter('prebid_global_settings', $settings);
return $settings;
}
/**
* Fetches a specific prebid bidder plugin.
*
* @param string $plugin_name
* Name of the plugin.
*
* @return
* An array with information about the requested bidder.
*/
function prebid_get_bidder($plugin_name) {
ctools_include('plugins');
return ctools_get_plugins('prebid', 'bidder', $plugin_name);
}
/**
* Fetches all bidder plugins.
*
* @return
* An array of arrays with information about all available prebid bidder
* plugins.
*/
function prebid_get_bidders() {
ctools_include('plugins');
return ctools_get_plugins('prebid', 'bidder');
}
/**
* Gets a class if available. Similar to ctools_export_ui_get_handler().
*
* @param array $plugin
* The plugin as returned from prebid_get_bidder().
*
* @return object|bool
* A class object or False.
*/
function prebid_get_handler($plugin) {
$cache =& drupal_static(__FUNCTION__, array());
if (empty($cache[$plugin['name']])) {
$class = ctools_plugin_get_class($plugin, 'handler');
if ($class) {
$cache[$plugin['name']] = new $class();
$cache[$plugin['name']]
->init($plugin);
}
}
return !empty($cache[$plugin['name']]) ? $cache[$plugin['name']] : FALSE;
}
Functions
Name | Description |
---|---|
prebid_bidder_process | Process function for the bidder plugin type. |
prebid_get_bidder | Fetches a specific prebid bidder plugin. |
prebid_get_bidders | Fetches all bidder plugins. |
prebid_get_global_settings | Settings used in js with an alter. |
prebid_get_handler | Gets a class if available. Similar to ctools_export_ui_get_handler(). |
prebid_get_price_granularity | Creates a default pricing bucket. |