"", 'spotlight' => array( array( 'ID' => "1220", 'Title' => ""New Hubble Constant Measurement Adds to Mystery of Universe's Expansion Rate", hubblesite.org
KICP in the News: July 16, 2019", 'Text' => ""The Hubble constant is the cosmological parameter that sets the absolute scale, size and age of the universe; it is one of the most direct ways we have of quantifying how the universe evolves," said <a href='http://kicp.uchicago.edu/people/profile/wendy_freedman.html'>Wendy L. Freedman</a>, John and Marion Sullivan University Professor in Astronomy and Astrophysics and KICP senior member. "The discrepancy that we saw before has not gone away, but this new evidence suggests that the jury is still out on whether there is an immediate and compelling reason to believe that there is something fundamentally flawed in our current model of the universe."", 'Post_Date' => "2019.07.16", 'Category' => "News", 'Image' => "depot/images/kicp-2019-07-16-wendy.png", 'WWW' => "https://hubblesite.org/contents/news-releases/2019/news-2019-28", 'New_Window' => "1", 'Show_Days' => "", 'Event_Start_Date' => "", 'Front_Display_Date' => "2019.11.01", 'Time' => "" ) ) ); ?> Kavli Institute for Cosmological Physics at the University of Chicago | KICP
'; $number = 0; $number_total = count($ARRAY); if (!in_array($id,range(1,$number_total))){$id = 0;} $today = date('Y.m.d'); $CHOICE = array(); if (!$id) # show default spotlight { $choosen = 0; # find important event or spotlight to show for ($i=0; $i<$number_total; $i++) { $show_days = (isset($ARRAY[$i]{'Show_Days'}) && $ARRAY[$i]{'Show_Days'}) ? $ARRAY[$i]{'Show_Days'} : 0; $up_to = date('Y.m.d',(time() - $show_days*24*3600)); if ($ARRAY[$i]{'Post_Date'}>$up_to) # new important spotlight { $CHOICE[] = $i; } else # event { if (isset($ARRAY[$i]{'Event_Start_Date'}) && $ARRAY[$i]{'Event_Start_Date'} && $ARRAY[$i]{'Event_Start_Date'}<=$today) { if (!isset($ARRAY[$i]{'Time'}) || !$ARRAY[$i]{'Time'}){$ARRAY[$i]{'Time'} = '24:00';} if ($ARRAY[$i]{'Event_Start_Date'}>=$up_to && $ARRAY[$i]{'Time'}>date('H:i')) # show ongoing event { $CHOICE[] = $i; } } } } if (!empty($CHOICE)) # if there important highlights { $choosen = time()%(count($CHOICE)); $number = $CHOICE[$choosen]; } else {$number = time()%$number_total ;} } else { $number = $id - 1; } $ITEM = $ARRAY[$number]; $read_more = ''; if ($ITEM{'WWW'}) { $new_window = (isset($ITEM{'New_Window'})) ? $ITEM{'New_Window'} : 1; $read_more = '
' . site_www('Read more >>',$ITEM{'WWW'},$new_window) . '
'; } $LINK = array('path'=>'index.php?' . $param . '='); $string = '
' . show_image(array('src'=>$PAGE{'data'}{'root'}. $ITEM{'Image'})) . '
' . show_list(spotarrow($number,$number_total,$LINK),'no_style'). '
' . $ITEM{'Title'} .'
' . $ITEM{'Text'} .'
' . $read_more. '
'; return $string; } #::::::::::::::::::::::::::::::::::: function param_get($param='',$type='get') { $print_name = 'param_get'; $string = ''; $PARAMS = array(); if ($type=='get') { $PARAMS = (isset($_GET)) ? $_GET : array(); } else { $PARAMS = (isset($_POST)) ? $_POST : array(); } if ($param) # particular param { if (isset($PARAMS{$param}) && $PARAMS{$param}) {$string = $PARAMS{$param};} return $string; } else # some param(s) { if (!empty($PARAMS)) { return $PARAMS; } } } #::::::::::::::::::::::::::::::::::: function site_www($name,$url,$new_window=0,$mouse_event='',$class='') { $string = $name; if ($name && $url) { $url = corrected_www($url); $target = ($new_window) ? ' target="_blank" ' : ' '; if ($class){$class = ' ' . $class;} if ($mouse_event){$mouse_event = ' ' . $mouse_event;} $string = '' . $name . ''; } return $string; } #::::::::::::::::::::::::::::::::::: function show_image($IMAGE,$width='',$height='') { $print_name = 'show_image'; $string = ''; $NEW = attribute_image($IMAGE); # force to resize (if requested) if ($width || $height) { $NEW{'width'} = ($width) ? $width : ''; $NEW{'height'} = ($height) ? $height : ''; } if (isset($NEW{'src'}) && $NEW{'src'}) { if (!isset($NEW{'alt'}) || !$NEW{'alt'}){$NEW{'alt'} = 'picture';} foreach($NEW as $key => $value) { if (strstr($key,'alt')) { $value = str_replace(array('"',"'"),'',$value); } if (!strstr($key,'href') && !strstr($key,'target') && !strstr($key,'new_window') && !strstr($key,'mouse_event') && !strstr($key,'float') && !strstr($key,'caption')) { $string .= ' ' . $key . '="' . $value . '"'; } } $string = ''; } if (isset($NEW{'href'}) && $NEW{'href'}) { $target = (isset($NEW{'target'})) ? $NEW{'target'} : 0; $mouse_event = (isset($NEW{'mouse_event'})) ? $NEW{'mouse_event'} : ''; $string = site_www($string,$NEW{'href'},$target,$mouse_event); } return $string; } #::::::::::::::::::::::::::::::::::: function show_list($ARRAY,$class_ul='',$class_li='') { $print_name = 'show_list'; $string = ''; $number = count($ARRAY); for ($i=0; $i<$number; $i++) { $class = ($class_li) ? 'class="' . $class_li . '"' : ''; $string .= '
  • ' . $ARRAY[$i] . '
  • '; } if ($string) { $class = ($class_ul) ? 'class="' . $class_ul . '"' : '' ; $string = ''; } return $string; } #::::::::::::::::::::::::::::::::::: function spotarrow($number,$number_total,$LINK) { $ARRAY = array(); $empty = 'start'; $previous_www = ''; $previous_name = $empty; $next_www = ''; $next_name = $empty; for ($i=0; $i<$number_total; $i++) { $www = ''; $name = 'out'; if ($i==$number) { $name = 'on'; if ($i) { $previous_www = $LINK{'path'} . $i; $previous_name = 'previous'; } if ($i!=($number_total-1)) { $next_www = $LINK{'path'} . ($i+2); $next_name = 'next'; } } else { $www = $LINK{'path'} . ($i + 1); } $name = show_image('images/feature-' . ($i + 1) . '_' . $name . '.png'); $ARRAY[] = site_www($name,$www); } # previous $ARRAY = array_merge(array(site_www(show_image('images/feature-' . $previous_name . '.png'),$previous_www)),$ARRAY); # next $ARRAY[] = site_www(show_image('images/feature-' . $next_name . '.png'),$next_www); return $ARRAY; } #::::::::::::::::::::::::::::::::::: function corrected_www($url) { global $PAGE; if ($url && strtolower(substr($url,0,4))!='http') { if (strtolower(substr($url,0,4))=='root') # relative link { $html_char = '/'; # - HTML replacment for '/' $url = str_replace(array('root/','ROOT/','root'. $html_char,'ROOT'. $html_char),$PAGE{'data'}{'root'},$url); } elseif (strtolower(substr($url,0,4))=='www.') # absolute link with ommited 'http' { $url = 'http://' . $url; } } return $url; } #::::::::::::::::::::::::::::::::::: function attribute_image($IMAGE) { global $NEW_WINDOW,$PAGE,$PATH_TO; # set target window for IMAGE on click $print_name = 'attribute_image'; $NEW = array(); if ((isset($PAGE{'data'}{'root'}) || isset($PAGE{'level'})) && !empty($IMAGE)) { if (is_array($IMAGE)) { if (isset($IMAGE{'src'}) && $IMAGE{'src'}) { $NEW = $IMAGE; if (is_array($NEW{'src'})) { unset($NEW{'src'}); $NEW{'src'} = $IMAGE{'src'}[0]; if (isset($IMAGE{'src'}[1]) && $IMAGE{'src'}[1]){$NEW{'href'} = $IMAGE{'src'}[1];} } else {$NEW{'src'} = $IMAGE{'src'};} } else { $NEW{'src'} = $IMAGE[0]; $NEW{'href'} = $IMAGE[1]; } } else {$NEW{'src'} = $IMAGE;} # put real image path $KEYS = array('src','href'); # images called from PAGE $path_to_image = ''; if (isset($PAGE{'level'}) && $PAGE{'level'}) { $path_to_image = str_repeat('../',$PAGE{'level'}); } elseif (isset($PAGE{'data'}{'root'})) { $path_to_image = $PAGE{'data'}{'root'}; } if (is_array($PAGE) && !empty($PAGE)) { for ($i=0; $i<2; $i++) { if (isset($NEW{$KEYS[$i]})) { if (substr($NEW{$KEYS[$i]},0,5)=='depot') { $NEW{$KEYS[$i]} = $PAGE{'data'}{'root'} . $NEW{$KEYS[$i]}; } elseif (substr($NEW{$KEYS[$i]},0,7)=='IMAGES/'){ $NEW{$KEYS[$i]} = str_replace('IMAGES/',$path_to_image . 'images/',$NEW{$KEYS[$i]}); } } } } if (isset($IMAGE{'target'})){$NEW{'target'} = $IMAGE{'target'};} if (isset($IMAGE{'new_window'})){$NEW{'target'} = $IMAGE{'new_window'};} if (!isset($NEW{'target'})) {$NEW{'target'} = $NEW_WINDOW{'image'};} if (!isset($NEW{'target'})) {$NEW{'target'} = 0;} # get width and height if they are not defined { if (stristr($NEW{'src'},'depot')) # image from database { $path = strstr($NEW{'src'},'depot'); } else # take images from 'images' directory of the project { $path = 'images' . strrchr($NEW{'src'},'/'); } if (isset($PAGE{'data'}{'root'})){$path = $PAGE{'data'}{'root'} . $path ;} if ($path && is_file($path)) { $SIZE{'width_max'} = (isset($NEW{'width'}) && $NEW{'width'}) ? $NEW{'width'} : 0; $SIZE{'height_max'} = (isset($NEW{'height'}) && $NEW{'height'}) ? $NEW{'height'} : 0; $DIM = image_dimensions($path,$SIZE); if (isset($DIM{'new'}{'width'}) && $DIM{'new'}{'width'} && isset($DIM{'new'}{'height'}) && $DIM{'new'}{'height'}) # image exists { $NEW{'width'} = $DIM{'new'}{'width'}; $NEW{'height'} = $DIM{'new'}{'height'}; } else { } } } } return $NEW; } #::::::::::::::::::::::::::::::::::: function image_dimensions($image_file,&$SIZE) { $print_name = 'image_dimensions'; $DIM = array(); if ($image_file) { # file exists on the server $file_exist = (is_file($image_file)) ? 1 : 0 ; # file exists on the WEB if (!$file_exist) # no file on the server { $file_exist = (url_exists($image_file)) ? 1 : 0 ; } if ($file_exist) { # file attribute $image_attribs = getimagesize($image_file); # $image_attribs[0] - width # $image_attribs[1] - height # $image_attribs[mime] - 'image/jpg' $SIZE{'type'} = $image_attribs{'mime'}; $width = (isset($image_attribs[0])) ? $image_attribs[0] : 0; $height = (isset($image_attribs[1])) ? $image_attribs[1] : 0; $DIM{'old'}{'width'} = $DIM{'new'}{'width'} = $width; $DIM{'old'}{'height'} = $DIM{'new'}{'height'} = $height; if ($width && $height) { $ratio_actual = $width/$height; # exect width OR/AND exect height if ((isset($SIZE{'width'}) && $SIZE{'width'}) || (isset($SIZE{'height'}) && $SIZE{'height'})) { if (isset($SIZE{'width'}) && $SIZE{'width'}!=$DIM{'old'}{'width'}) {$width = $SIZE{'width'};} if (isset($SIZE{'height'}) && $SIZE{'height'} && $SIZE{'height'}!=$DIM{'old'}{'height'}) {$height = $SIZE{'height'};} } elseif ((isset($SIZE{'width_max'}) && $SIZE{'width_max'}) || (isset($SIZE{'height_max'}) && $SIZE{'height_max'})) { if (isset($SIZE{'width_max'}) && $SIZE{'width_max'} && $DIM{'old'}{'width'} > $SIZE{'width_max'} ){$width = $SIZE{'width_max'};} if (isset($SIZE{'height_max'}) && $SIZE{'height_max'} && $DIM{'old'}{'height'} > $SIZE{'height_max'} ){$height = $SIZE{'height_max'};} } if ($DIM{'new'}{'width'} != $width || $DIM{'new'}{'height'} != $height) { if (($height*$DIM{'old'}{'width'}) < ($width*$DIM{'old'}{'height'})) { $DIM{'new'}{'height'} = $height; $DIM{'new'}{'width'} = round($height*$DIM{'old'}{'width'}/$DIM{'old'}{'height'}); } elseif (($height*$DIM{'old'}{'width'}) > ($width*$DIM{'old'}{'height'})) { $DIM{'new'}{'width'} = $width; $DIM{'new'}{'height'} = round($width*$DIM{'old'}{'height'}/$DIM{'old'}{'width'}); } else { $DIM{'new'}{'width'} = $width; $DIM{'new'}{'height'} = $height; } } } } } return $DIM; } #::::::::::::::::::::::::::::::::::: function url_exists($string) { $ok = 0; if ($string && substr(strtolower($string),0,4)=='http') { $headers = get_headers($string); $ok = stripos($headers[0],"200 OK") ? 1 : 0; } return $ok; } #::::::::::::::::::::::::::::::::::: ?>