/** * Display a link to the license associated with this resource * * @param array $license License name * @return string HTML */ public static function license($license) { include_once dirname(__DIR__) . DS . 'tables' . DS . 'license.php'; $license = str_replace(' ', '-', strtolower($license)); $license = preg_replace("/[^a-zA-Z0-9\\-_]/", '', $license); $database = \App::get('db'); $rl = new \Components\Resources\Tables\License($database); $rl->load($license); $html = ''; if ($rl->id) { if (substr($rl->name, 0, 6) != 'custom') { $html = '<p class="' . $rl->name . ' license">Licensed'; if ($rl->url) { $html .= ' according to <a rel="license" href="' . $rl->url . '" title="' . $rl->title . '">this deed</a>'; } else { $html .= ' under ' . $rl->title; } $html .= '.</p>'; } else { $html = '<p class="' . $rl->name . ' license">Licensed according to <a rel="license" class="popup" href="' . Route::url('index.php?option=com_resources&task=license&resource=' . substr($rl->name, 6) . '&no_html=1') . '">this deed</a>.</p>'; } } return $html; }