diff -u b/flickr.admin.inc b/flickr.admin.inc --- b/flickr.admin.inc +++ b/flickr.admin.inc @@ -224,7 +224,7 @@ $form['date_formats_settings']['flickr_date_format_image_title'] = array( '#type' => 'select', '#title' => t('When hovering an image (mouse-over)'), - '#default_value' => variable_get('flickr_date_format_image_title', 'short'), + '#default_value' => variable_get('flickr_date_format_image_title', 'medium'), '#options' => $formats, '#empty_option' => t('- None -'), '#empty_value' => 'none', @@ -246,6 +246,12 @@ '#empty_option' => t('- None -'), '#empty_value' => 'none', ); + // Disable the caption hover option if a date in the caption is set to 'none'. + if (variable_get('flickr_date_format_image_caption', 'interval') == 'none') { + $form['date_formats_settings']['flickr_date_format_image_caption_hover']['#disabled'] = TRUE; + $form['date_formats_settings']['flickr_date_format_image_caption_hover']['#title'] = '' . t('When hovering a date in the caption') . ''; + $form['date_formats_settings']['flickr_date_format_image_caption_hover']['#description'] = t('Disabled until a date format for the image caption is selected.'); + } $form['date_formats_settings']['flickr_date_format_album_title'] = array( '#type' => 'select', '#title' => t('In the album title'), diff -u b/flickr.inc b/flickr.inc --- b/flickr.inc +++ b/flickr.inc @@ -311,7 +311,7 @@ $info = !is_array($photo['title']) ? flickr_photos_getinfo($photo['id']) : ''; if (isset($info['dates']) || isset($photo['dates'])) { $date_taken = isset($info['dates']['taken']) ? $info['dates']['taken'] : $photo['dates']['taken']; - $format_title = variable_get('flickr_date_format_image_title', 'short'); + $format_title = variable_get('flickr_date_format_image_title', 'medium'); switch ($format_title) { case 'interval': $taken_short = format_interval(time() - strtotime($date_taken), 1) . ' ' . t('ago'); @@ -579,11 +579,14 @@ // As variables might change during processing, we set a fixed version of it // to use for the key to set the block cache after processing at the end. $idfix = $id; + // Standarize the date format, independent from the input. $datefromfix = $datefrom; $datetofix = $dateto; if (!isset($dateto)) { $dateto = $datefrom; } + $datefrom = empty($datefrom) ? '' : date("Y-m-d", strtotime($datefrom)); + $dateto = empty($dateto) ? '' : date("Y-m-d", strtotime($dateto)); $datefrom = isset($datefrom) ? $datefrom . ' 00:00:00' : ''; $dateto = isset($dateto) ? $dateto . ' 23:59:59' : ''; // Remove spaces from tags but save the original for matches in text instead @@ -598,7 +601,7 @@ if ($tag_mode == 'context') { $tag_mode = empty($id) || $id == 'public' || $id == '39873962@N08' ? 'all' : 'any'; } - if ($extend && $tag_mode == 'all') { + if ($extend && $tag_mode == 'all' && strpos($tags, ',') !== FALSE) { $tag_mode = 'any'; drupal_set_message(t("The tag mode has been forced to 'any' (OR) for extended text matching (tags, titles and description). To use 'all' (AND) put 'extend=false' in Flickr's text filter code."), 'warning', FALSE); } @@ -752,21 +755,17 @@ $format = empty($datefrom) ? 'none' : variable_get('flickr_date_format_album_title', 'short'); switch ($format) { case 'interval': - $formated_datefrom = format_interval(time() - strtotime(substr($datefrom, 0, 10)), 1); - $formated_dateto = format_interval(time() - strtotime(substr($dateto, 0, 10)), 1); - break; - case 'none': - $formated_datefrom = ''; - $formated_dateto = ''; + $formated_datefrom = format_interval(time() - strtotime(substr($datefrom, 0, 10)), 1); + $formated_dateto = format_interval(time() - strtotime(substr($dateto, 0, 10)), 1); break; default: - $formated_datefrom = format_date(strtotime(substr($datefrom, 0, 10)), $format, '', NULL); - $formated_dateto = format_date(strtotime(substr($dateto, 0, 10)), $format, '', NULL); + $formated_datefrom = format_date(strtotime(substr($datefrom, 0, 10)), $format, '', NULL); + $formated_dateto = format_date(strtotime(substr($dateto, 0, 10)), $format, '', NULL); } if ((empty($datetofix) || $datetofix == $datefromfix || $formated_datefrom == $formated_dateto) && !empty($datefromfix)) { // Remove the time by capturing anything preceding one or more digits // followed by a colon. See http://rubular.com/r/7IJhj19P9K - $match1 = preg_match('/^(.*?)[-|\s].\d+:/', $formated_datefrom, $match); + $match1 = preg_match('/^(.*?)[-|\s].\d*:/', $formated_datefrom, $match); // Only use the match if there is one (date with time). $date1 = isset($match[1]) ? $match[1] : $formated_datefrom; $taken = ($format == 'interval') ? ' ' . t('taken') . ' ' . $formated_datefrom . ' ' . t('ago') : ' ' . t('taken on') . ' ' . $date1; @@ -774,9 +773,9 @@ // Multiple days. elseif (!empty($datefromfix)) { // Remove the times. - $match1 = preg_match('/^(.*?)[-|\s].\d+:/', $formated_datefrom, $matchfrom); + $match1 = preg_match('/^(.*?)[-|\s].\d*:/', $formated_datefrom, $matchfrom); if (isset($matchfrom[1])) { - preg_match('/^(.*?)[-|\s].\d+:/', $formated_dateto, $matchto); + preg_match('/^(.*?)[-|\s].\d*:/', $formated_dateto, $matchto); $date1 = $matchfrom[1]; $date2 = $matchto[1]; } @@ -788,11 +787,8 @@ case 'interval': $taken = ' ' . t('taken') . ' ' . $formated_datefrom . ' ' . t('to') . ' ' . $formated_dateto . ' ' . t('ago'); break; - case 'none': - $taken = ''; - break; default: - $taken = ' ' . t('taken from') . ' ' . $date1 . ' ' . t('to') . ' ' . $date2; + $taken = ' ' . t('taken from') . ' ' . $date1 . ' ' . t('to') . ' ' . $date2; } } else { @@ -800,6 +796,7 @@ $datefrom = ''; $dateto = ''; } + $taken = $format == 'none' ? '' : $taken; // Generate an album heading depending on type. switch ($type) { diff -u b/flickr.module b/flickr.module --- b/flickr.module +++ b/flickr.module @@ -622,7 +622,7 @@ $format_taken = variable_get('flickr_date_format_image_caption', 'interval'); switch ($format_taken) { case 'interval': - $taken_taken = format_interval(time() - strtotime($info['dates']['taken']), 1) . ' ' . t('ago'); + $taken = format_interval(time() - strtotime($info['dates']['taken']), 1) . ' ' . t('ago'); break; case 'none': $taken = '';