| 1 |
<?php |
<?php |
| 2 |
// $Id: nodewords.admin.inc,v 1.1.2.110 2009/11/26 19:52:50 kiam Exp $ |
// $Id: nodewords.admin.inc,v 1.1.2.111 2009/11/26 22:24:53 kiam Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 139 |
'fieldset' => FALSE, |
'fieldset' => FALSE, |
| 140 |
) |
) |
| 141 |
); |
); |
|
$result = _nodewords_check_enabled_modules(); |
|
|
|
|
| 142 |
if (empty($nodewords_form)) { |
if (empty($nodewords_form)) { |
| 143 |
$bool = ( |
if (!count(array_filter(variable_get('nodewords_edit', array())))) { |
|
!$result && |
|
|
!count(array_filter(variable_get('nodewords_edit', array()))) |
|
|
); |
|
|
|
|
|
if ($bool) { |
|
| 144 |
drupal_set_message( |
drupal_set_message( |
| 145 |
t( |
t( |
| 146 |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
| 269 |
$head_tags = variable_get('nodewords_head', array()); |
$head_tags = variable_get('nodewords_head', array()); |
| 270 |
$tags_info = nodewords_get_possible_tags(); |
$tags_info = nodewords_get_possible_tags(); |
| 271 |
|
|
| 272 |
_nodewords_check_enabled_modules(); |
if (!empty($tags_info)) { |
| 273 |
|
foreach ($tags_info as $name => $info) { |
| 274 |
|
$edit_options[$name] = $head_options[$name] = $info['widget:label']; |
| 275 |
|
} |
| 276 |
|
|
| 277 |
foreach ($tags_info as $name => $info) { |
uasort($edit_options, 'strnatcmp'); |
| 278 |
$edit_options[$name] = $head_options[$name] = $info['widget:label']; |
uasort($head_options, 'strnatcmp'); |
| 279 |
|
} |
| 280 |
|
else { |
| 281 |
|
drupal_set_message(t('There are no modules that implement meta tags. You need to enable at least one module between nodewords_basic.module, nodewords_extra.module, and nodewords_verification_tags.module that are listed under <em>Meta tags</em> in the <a href="@modules-page">modules page</a>.', array('@modules-page' => url('admin/build/modules'))), 'error'); |
| 282 |
} |
} |
|
|
|
|
uasort($edit_options, 'strnatcmp'); |
|
|
uasort($head_options, 'strnatcmp'); |
|
| 283 |
|
|
| 284 |
$form['edit'] = array( |
$form['edit'] = array( |
| 285 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 288 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 289 |
); |
); |
| 290 |
|
|
| 291 |
$form['edit']['nodewords_edit'] = array( |
if (!empty($tags_info)) { |
| 292 |
'#type' => 'checkboxes', |
$form['edit']['nodewords_edit'] = array( |
| 293 |
'#options' => $edit_options, |
'#type' => 'checkboxes', |
| 294 |
'#default_value' => $edit_tags, |
'#options' => $edit_options, |
| 295 |
'#checkall' => TRUE, |
'#default_value' => $edit_tags, |
| 296 |
); |
'#checkall' => TRUE, |
| 297 |
|
); |
| 298 |
|
} |
| 299 |
|
else { |
| 300 |
|
$form['edit']['nodewords_edit'] = array( |
| 301 |
|
'#type' => 'value', |
| 302 |
|
'#value' => $edit_tags, |
| 303 |
|
); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
$form['head'] = array( |
$form['head'] = array( |
| 307 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 310 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 311 |
); |
); |
| 312 |
|
|
| 313 |
$form['head']['nodewords_head'] = array( |
if (!empty($tags_info)) { |
| 314 |
'#type' => 'checkboxes', |
$form['head']['nodewords_head'] = array( |
| 315 |
'#options' => $head_options, |
'#type' => 'checkboxes', |
| 316 |
'#default_value' => $head_tags, |
'#options' => $head_options, |
| 317 |
'#checkall' => TRUE, |
'#default_value' => $head_tags, |
| 318 |
); |
'#checkall' => TRUE, |
| 319 |
|
); |
| 320 |
|
} |
| 321 |
|
else { |
| 322 |
|
$form['head']['nodewords_head'] = array( |
| 323 |
|
'#type' => 'value', |
| 324 |
|
'#value' => $head_tags, |
| 325 |
|
); |
| 326 |
|
} |
| 327 |
|
|
| 328 |
$form['metatags_creation'] = array( |
$form['metatags_creation'] = array( |
| 329 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 458 |
*/ |
*/ |
| 459 |
function nodewords_tags_form(&$form_state, $type = NODEWORDS_TYPE_DEFAULT, $id = '') { |
function nodewords_tags_form(&$form_state, $type = NODEWORDS_TYPE_DEFAULT, $id = '') { |
| 460 |
$form = array(); |
$form = array(); |
|
|
|
| 461 |
$form['#nodewords_type'] = $type; |
$form['#nodewords_type'] = $type; |
| 462 |
$form['#nodewords_id'] = $id; |
$form['#nodewords_id'] = $id; |
| 463 |
|
|
|
$result = _nodewords_check_enabled_modules(); |
|
|
|
|
| 464 |
$form['nodewords'] = nodewords_form( |
$form['nodewords'] = nodewords_form( |
| 465 |
$type, |
$type, |
| 466 |
nodewords_load_tags($type, $id), |
nodewords_load_tags($type, $id), |
| 470 |
); |
); |
| 471 |
|
|
| 472 |
if (empty($form['nodewords'])) { |
if (empty($form['nodewords'])) { |
| 473 |
$bool = ( |
if (!count(array_filter(variable_get('nodewords_edit', array())))) { |
|
!$result && |
|
|
!count(array_filter(variable_get('nodewords_edit', array()))) |
|
|
); |
|
|
|
|
|
if ($bool) { |
|
| 474 |
drupal_set_message( |
drupal_set_message( |
| 475 |
t( |
t( |
| 476 |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |