| 1 |
<?php |
<?php |
| 2 |
// $Id: creativecommons.module,v 1.9.2.62 2009/11/04 08:14:54 balleyne Exp $ |
// $Id: creativecommons.module,v 1.9.2.63 2009/11/04 08:16:42 balleyne Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 196 |
'#default_value' => variable_get('creativecommons_nc_img', ''), |
'#default_value' => variable_get('creativecommons_nc_img', ''), |
| 197 |
); |
); |
| 198 |
|
|
|
//TODO: 2.x any other display settings? ccREL, sentence structure? |
|
|
|
|
|
// TODO: 2.x revisit (and probably remove) this when ccREL is implemented, since RDF/XML is no longer recommended |
|
|
$form['creativecommons_display']['creativecommons_rdf'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Insert RDF/XML'), |
|
|
'#return_value' => 1, |
|
|
'#default_value' => variable_get('creativecommons_rdf', TRUE), |
|
|
'#description' => t('Attach machine-readable license information as RDF/XML within the HTML of a node to let visitors know what license applies to your works.'), |
|
|
); |
|
| 199 |
|
|
| 200 |
// TODO: 2.x license text for all licenses should be configurable |
// TODO: 2.x license text for all licenses should be configurable |
| 201 |
$form['creativecommons_display']['creativecommons_arr_text'] = array( |
$form['creativecommons_display']['creativecommons_arr_text'] = array( |
| 214 |
$form['creativecommons_advanced'] = array( |
$form['creativecommons_advanced'] = array( |
| 215 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 216 |
'#title' => t('Advanced'), |
'#title' => t('Advanced'), |
|
'#description' => t('Options for how the Creative Commons module interacts with other Drupal modules.'), |
|
| 217 |
); |
); |
| 218 |
|
|
| 219 |
$form['creativecommons_advanced']['creativecommons_search'] = array( |
$form['creativecommons_advanced']['creativecommons_search'] = array( |
| 220 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 221 |
'#title' => t('Creative Commons Search'), |
'#title' => t('Creative Commons Search'), |
| 222 |
'#default_value' => variable_get('creativecommons_search', TRUE), |
'#default_value' => variable_get('creativecommons_search', TRUE), |
| 223 |
|
'#description' => t('Enabled CC search options'), |
| 224 |
); |
); |
| 225 |
|
|
| 226 |
|
// TODO: 2.x revisit (and probably remove) this when ccREL is implemented, since RDF/XML is no longer recommended |
| 227 |
|
$form['creativecommons_advanced']['creativecommons_rdf'] = array( |
| 228 |
|
'#type' => 'checkbox', |
| 229 |
|
'#title' => t('Insert RDF/XML'), |
| 230 |
|
'#return_value' => 1, |
| 231 |
|
'#default_value' => variable_get('creativecommons_rdf', TRUE), |
| 232 |
|
'#description' => t('Attach machine-readable license information as RDF/XML within the HTML of a node to let visitors know what license applies to your works.'), |
| 233 |
|
); |
| 234 |
|
|
| 235 |
|
$form['creativecommons_advanced']['creativecommons_node_license_redundant_display'] = array( |
| 236 |
|
'#type' => 'checkbox', |
| 237 |
|
'#title' => t('Display node license when same as site license'), |
| 238 |
|
'#return_value' => 1, |
| 239 |
|
'#default_value' => variable_get('creativecommons_node_license_redundant_display', TRUE), |
| 240 |
|
'#description' => t('Note: if not displayed, node specific metadata won\'t be displayed either.'), |
| 241 |
|
); |
| 242 |
} |
} |
| 243 |
return system_settings_form($form); |
return system_settings_form($form); |
| 244 |
|
|
| 1664 |
//TODO: don't display license block if user doesn't have permission to view node... |
//TODO: don't display license block if user doesn't have permission to view node... |
| 1665 |
// what's arg(0) and arg(2)? |
// what's arg(0) and arg(2)? |
| 1666 |
if ( $node && arg(0) == 'node' && ( $node->cc && $node->cc->is_available()) && ( (arg(2)=='view') || (arg(2)=='') ) ) { |
if ( $node && arg(0) == 'node' && ( $node->cc && $node->cc->is_available()) && ( (arg(2)=='view') || (arg(2)=='') ) ) { |
| 1667 |
|
// Check for redundant site license |
| 1668 |
|
$site_license_display = variable_get('creativecommons_site_license_display', FALSE); |
| 1669 |
|
$site_license = creativecommons_get_site_license(); |
| 1670 |
|
$redundant_display = variable_get('creativecommons_node_license_redundant_display', TRUE); |
| 1671 |
|
if ($site_license_display && !$redundant_display && $node->cc->uri == $site_license->uri){ |
| 1672 |
|
return; |
| 1673 |
|
} |
| 1674 |
|
|
| 1675 |
// license html |
// license html |
| 1676 |
$block['content'] = $node->cc->get_html(); |
$block['content'] = $node->cc->get_html(); |
| 1677 |
return $block; |
return $block; |