View source
<?php
function shrinktheweb_help($path, $arg) {
switch ($path) {
case 'admin/help#shrinktheweb':
return '<p>' . t('You can find the latest help information for the ShrinkTheWeb module at !url .', array(
'!url' => '<a href="http://drupal.org/node/1067900" target="_blank">http://drupal.org/node/1067900</a>',
)) . '</p>';
}
}
function shrinktheweb_perm() {
return array(
'administer ShrinkTheWeb settings',
);
}
function shrinktheweb_theme($existing, $type, $theme, $path) {
return array(
'shrinktheweb_image' => array(
'variables' => array(
'url' => NULL,
'options' => NULL,
),
),
);
}
function shrinktheweb_menu() {
$items = array();
$items['admin/settings/shrinktheweb'] = array(
'title' => 'ShrinkTheWeb',
'description' => 'Configure API settings such as public, private keys, thumbnails cache and other',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'shrinktheweb_admin_settings',
),
'access arguments' => array(
'administer ShrinkTheWeb settings',
),
'file' => 'shrinktheweb.admin.inc',
);
$items['admin/settings/shrinktheweb/settings'] = array(
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/settings/shrinktheweb/log'] = array(
'title' => 'Log',
'description' => 'Browse the request records',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'shrinktheweb_admin_log',
),
'access arguments' => array(
'administer ShrinkTheWeb settings',
),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
'file' => 'shrinktheweb.admin.inc',
);
return $items;
}
function shrinktheweb_get_thumbnail($url, $options = array()) {
module_load_include('inc', 'shrinktheweb', 'shrinktheweb.api');
$sImageURL = shrinktheweb_getThumbnailURL($url, $options);
return $sImageURL;
}
function theme_shrinktheweb_image($url, $options = array()) {
$src = shrinktheweb_get_thumbnail($url);
if ($src) {
return l(theme('image', $src, $options['alt'], $options['title'], NULL, FALSE), $url, array(
'html' => TRUE,
'attributes' => array(
'target' => '_blank',
),
));
}
return FALSE;
}