| 11 |
* Module will provide block per key |
* Module will provide block per key |
| 12 |
*/ |
*/ |
| 13 |
|
|
| 14 |
define('TEXTLINKADS_VERSION', '$Id: textlinkads.module,v 1.5.2.2 2007/11/19 18:08:21 robertDouglass Exp $'); |
define('TEXTLINKADS_VERSION', '$Id: textlinkads.module,v 1.5.2.3 2007/11/19 18:29:37 robertDouglass Exp $'); |
| 15 |
define('TEXTLINKADS_MODULE_PATH', drupal_get_path('module', 'textlinkads')); |
define('TEXTLINKADS_MODULE_PATH', drupal_get_path('module', 'textlinkads')); |
| 16 |
|
|
| 17 |
function textlinkads_help($section) { |
function textlinkads_help($section) { |
| 48 |
} |
} |
| 49 |
|
|
| 50 |
function textlinkads_cron() { |
function textlinkads_cron() { |
| 51 |
|
// The strlen check here is to expedite the case where the module has just been |
| 52 |
|
// installed and there aren't any links yet, or if there are no links and |
| 53 |
|
// we want to see as quickly as possible if any are available. |
| 54 |
if( variable_get('textlinkads_last_update', 0) < (time() - 3600) || strlen(textlinkads_get_links('text')) < 20) { |
if( variable_get('textlinkads_last_update', 0) < (time() - 3600) || strlen(textlinkads_get_links('text')) < 20) { |
| 55 |
textlinkads_check_update(); |
textlinkads_check_update(); |
| 56 |
} |
} |
| 431 |
* returns a single $link |
* returns a single $link |
| 432 |
* |
* |
| 433 |
*/ |
*/ |
| 434 |
function textlinkads_next_rss_ad() { |
//function textlinkads_next_rss_ad() { |
| 435 |
static $links = NULL; |
// static $links = NULL; |
| 436 |
|
// |
| 437 |
if (!is_array($links)) { |
// if (!is_array($links)) { |
| 438 |
$keys = textlinkads_get_keys(); |
// $keys = textlinkads_get_keys(); |
| 439 |
$key = $keys[0]; // rss is first key |
// $key = $keys[0]; // rss is first key |
| 440 |
$links = textlinkads_get_links('rss', $key); |
// $links = textlinkads_get_links('rss', $key); |
| 441 |
shuffle($links); |
// shuffle($links); |
| 442 |
} |
// } |
| 443 |
|
// |
| 444 |
return array_pop($links); |
// return array_pop($links); |
| 445 |
} |
//} |
| 446 |
|
|
| 447 |
/** |
/** |
| 448 |
* Builds an array with the information needed to render ads on the site or in RSS |
* Builds an array with the information needed to render ads on the site or in RSS |