diff --git a/README.txt b/README.txt index 72180ec..ef778fc 100644 --- a/README.txt +++ b/README.txt @@ -82,7 +82,7 @@ Installing Nodewords (first time installation) "keywords", "logo", "original-source", "revisit-after", "rights", "robots", and "standout" meta tags, and the "title" HTML tag. - Nodewords extra meta tags: for Dublin Core, "geo.placename", - "geo.position", "geo.region", "icbm" and "shorturl" meta tags. + "geo.position", "geo.region", "icbm" and "shortlink" meta tags. - Nodewords Open Graph meta tags: for the Open Graph Protocol meta tags, used for integration with Facebook's API. diff --git a/nodewords_extra/nodewords_extra.info b/nodewords_extra/nodewords_extra.info index 4da340b..7bb803b 100644 --- a/nodewords_extra/nodewords_extra.info +++ b/nodewords_extra/nodewords_extra.info @@ -1,5 +1,5 @@ name = "Nodewords extra meta tags" -description = "Add the Dublin Core, 'geo.placename', 'geo.position', 'geo.region', 'icbm' and 'shorturl' meta tags." +description = "Add the Dublin Core, 'geo.placename', 'geo.position', 'geo.region', 'icbm' and 'shortlink' meta tags." dependencies[] = nodewords package = SEO core = 6.x diff --git a/nodewords_extra/nodewords_extra.install b/nodewords_extra/nodewords_extra.install index 9febb52..f2adf0e 100644 --- a/nodewords_extra/nodewords_extra.install +++ b/nodewords_extra/nodewords_extra.install @@ -64,3 +64,21 @@ function nodewords_extra_uninstall() { db_query("DELETE FROM {nodewords} WHERE name IN (". db_placeholders($metatags, 'varchar') .")", $metatags); } } + +/** + * Convert the 'name' field from "shorturl" to "shortlink" for existing records. + */ +function nodewords_extra_update_6108() { + $ret = array(); + + // Check to see if any records need to be updated. + $count = db_result(db_query("SELECT COUNT(mtid) FROM {nodewords} WHERE name='shorturl'")); + + // Update the records. + if ($count) { + $ret[] = update_sql("UPDATE {nodewords} SET name='shortlink' WHERE name='shorturl'"); + drupal_set_message(t('Converted @count "shorturl" meta tags to "shortlink" meta tags.', array('@count' => $count))); + } + + return $ret; +} diff --git a/nodewords_extra/nodewords_extra.module b/nodewords_extra/nodewords_extra.module index 7825d1a..0a27079 100644 --- a/nodewords_extra/nodewords_extra.module +++ b/nodewords_extra/nodewords_extra.module @@ -150,8 +150,8 @@ function nodewords_extra_nodewords_tags_info() { ), 'weight' => array('geo.region' => -150), ), - 'shorturl' => array( - 'callback' => 'nodewords_extra_shorturl', + 'shortlink' => array( + 'callback' => 'nodewords_extra_shortlink', 'context' => array( 'denied' => array( NODEWORDS_TYPE_DEFAULT, @@ -160,14 +160,14 @@ function nodewords_extra_nodewords_tags_info() { NODEWORDS_TYPE_TRACKER, ), ), - 'label' => t('Short URL'), + 'label' => t('Shortlink (URL)'), 'permission' => 'edit short URL meta tag', 'templates' => array( 'head' => array( - 'shorturl' => NODEWORDS_LINK_REL, + 'shortlink' => NODEWORDS_LINK_REL, ), ), - 'weight' => array('shorturl' => -138), + 'weight' => array('shortlink' => -138), ), ); @@ -656,24 +656,24 @@ function nodewords_extra_location_prepare(&$tags, $content, $options) { /** * Set the form fields used to implement the options for the meta tag. */ -function nodewords_extra_shorturl_form(&$form, $content, $options) { - $form['shorturl'] = array( +function nodewords_extra_shortlink_form(&$form, $content, $options) { + $form['shortlink'] = array( '#tree' => TRUE, '#weight' => -138, ); - $form['shorturl']['value'] = array( + $form['shortlink']['value'] = array( '#type' => 'textfield', - '#title' => t('Short URL'), - '#description' => t('Short URLs are used instead of the original URL because they are shorter, and easier to remember. Short URLs are provided by some web services, such as bit.ly, ShortURL, and TinyURL.', array('@bitly' => 'http://bit.ly', '@shorturl' => 'http://shorturl.com', '@tinyurl' => 'http://tinyurl.com')), + '#title' => t('Shortlink URL'), + '#description' => t('Shortlink URLs are used instead of the original URL because they are shorter, and easier to remember. Short URLs are provided by some web services, such as bit.ly, and TinyURL.', array('@bitly' => 'http://bit.ly', '@tinyurl' => 'http://tinyurl.com')), '#default_value' => empty($content['value']) ? '' : $content['value'], - '#element_validate' => array('nodewords_extra_shorturl_form_validate'), + '#element_validate' => array('nodewords_extra_shortlink_form_validate'), '#size' => 60, '#maxlength' => variable_get('nodewords_max_size', 350), ); } -function nodewords_extra_shorturl_form_validate($element, &$form_state) { +function nodewords_extra_shortlink_form_validate($element, &$form_state) { if (!empty($element['#value'])) { if (!valid_url($element['#value'], TRUE)) { form_error($element, t('The short URL is not a valid absolute URL.')); @@ -684,9 +684,9 @@ function nodewords_extra_shorturl_form_validate($element, &$form_state) { /** * Set the meta tag content. */ -function nodewords_extra_shorturl_prepare(&$tags, $content, $options) { +function nodewords_extra_shortlink_prepare(&$tags, $content, $options) { if (!empty($content['value'])) { - $tags['shorturl'] = check_url($content['value']); + $tags['shortlink'] = check_url($content['value']); } }