'comminit', 'callback' => 'comminit_showtext', 'access' => $view, 'weight' => 5); /* $result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title'); while ($category = db_fetch_array($result)) { $items[] = array('path' => 'aggregator/categories/'. $category['cid'], 'title' => $category['title'], 'callback' => 'aggregator_page_category', 'access' => $view); } */ return $items; } /** * consolidate the head tag of the HTML page. * This function can be called as long the headers aren't sent. */ function comminit_get_html_head($args = array()) { global $theme; $comminit_temp_dir_alone = "temp"; $comminit_temp_dir = $comminit_temp_dir_alone; $get = $_GET; if ($get == null) { $get = "_"; } if (is_array($get)) { $get = implode("_",$get); } $get .= urlencode($theme); if (!is_array($args)) { $args = func_get_args(); // get the args } $pat[0] = '/\t /'; $rep[0] = '/ /'; $pat[1] = '/ /'; $rep[1] = '/ /'; $args = implode("\n",$args); // compress them $args = preg_replace($pat, $rep, $args); $args = str_replace('\n"; $args = explode("\n",$args); // split them all for ($x = 0; $x < count($args); $x++) { $args[$x] = trim($args[$x]); if (($x > 0) && ($args[$x] == $args[$x-1])) { $args[$x-1] = ""; } } // $args = array_unique($args); // // the meat of this function // read all of the files, load them, consolidate them then remake data and then links to same // for ($x = 0; $x < count($args); $x++) { $css_found = false; $js_found = false; // echo "\n"; if (strpos($args[$x],'type="text/css"')) { // load a CSS file $file = str_replace('','',$file); $file = trim($file); if ((strlen(trim($file)) > 3) && (comminit_file_exists('http://'.$_SERVER['HTTP_HOST'].$file))) { if ($css[] = @file_get_contents('http://'.$_SERVER['HTTP_HOST'].$file)) { $reference_css = true; $css_found = true; $stored_head_html[] = ""; } else { $stored_head_html[] = $args[$x]; echo "couldn't find anything at ".'http://'.$_SERVER['HTTP_HOST'].$file."\n"; } } } if (strpos($args[$x],'type="text/javascript"')) { // load a JS file $file = str_replace('','',$file); $file = trim($file); if ((strlen(trim($file)) > 3) && (comminit_file_exists('http://'.$_SERVER['HTTP_HOST'].$file))) { if ($js[] = @file_get_contents('http://'.$_SERVER['HTTP_HOST'].$file)) { $reference_js = true; $js_found = true; $stored_head_html[] = ""; } else { $stored_head_html[] = $args[$x]; // echo "couldn't find anything at ".'http://'.$_SERVER['HTTP_HOST'].$file."\n"; } } } if (($css_found == false) && ($js_found == false) && (strlen($args[$x]) > 2)) { $stored_head_html[] = $args[$x]; } } if ($reference_css == true) { $filename = $comminit_temp_dir.'/css/css'.urlencode($get).'.css'; // make a CSS file reference comminit_write_temp_file($filename,implode("\n",$css)); // the big CSS file // add the reference to the $stored_head_html $stored_head_html[] = ''; $stored_head_html[] = ''; } if ($reference_js == true) { $filename = $comminit_temp_dir.'/js/js'.urlencode($get).'.js'; // make a JS file reference comminit_write_temp_file($filename,implode("\n",$js)); // the big JS file // add the reference to the $stored_head_html $stored_head_html[] = ''; } $filename = $comminit_temp_dir.'/html/header_'.urlencode($get).'.html'; // make a HTML file reference comminit_write_temp_file($filename,implode("\n",$stored_head_html)); // the references to the above return implode("\n",$stored_head_html); } /** * write to a static file */ function comminit_write_temp_file($filename,$data) { $comminit_temp_dir_alone = "temp"; $result = FALSE; if (comminit_file_exists($filename)) { // great... unlink($filename); } if ($fh = fopen($filename, 'w')) { fwrite($fh, $data); fclose($fh); $result = TRUE; } return $result; } /** * This is the file_exists function pushed inside of this to allow us to trick it out or limit it. */ function comminit_file_exists($file) { $result = false; if (file_exists($file)) { $result = true; } return $result; } /** * Generate output */ function comminit_showtext($edit = array()) { $x = 0; while (strlen(arg($x)) > 0) { $output .= " ".arg($x); $output = trim($output); $x++; } return $output; } /** * This returns the taxonomy divided and organized by vocabulary. */ function comminit_taxonomy_by_vocabulary($taxonomy,$format = 0) { $sectioncomma = ""; $customcomma = ""; $vacancycomma = ","; $result = array(); foreach ($taxonomy as $terms) { switch ($format) { case 1: // the checkbox one... if ($terms->vid == 12) { $result['site'] = ''.$terms->name.''; } if ($terms->vid == 5) { $result['custom code'] .= $customcomma.l($terms->name,"taxonomy/term/".$terms->tid); $customcomma = ","; } if ($terms->vid == 11) { $result['section'] .= $sectioncomma.l($terms->name,"taxonomy/term/".$terms->tid); $sectioncomma = ","; } if ($terms->vid == 13) { $result['vacancy_sectors'] .= $vacancycomma.l($terms->name,"taxonomy/term/".$terms->tid); $vacancycomma = ","; } break; default: /* 12 Sites 11 Sections 5 Custom Codes 13 Vacancy Sectors 14 Spanish Categories */ if ($terms->vid == 12) { $result['site'] = ''.$terms->name.''; } if ($terms->vid == 5) { $result['custom code'] .= $customcomma.l($terms->name,"taxonomy/term/".$terms->tid); $customcomma = ","; } if ($terms->vid == 11) { $result['section'] .= $sectioncomma.l($terms->name,"taxonomy/term/".$terms->tid); $sectioncomma = ","; } if ($terms->vid == 13) { $result['vacancy_sectors'] .= $vacancycomma.l($terms->name,"taxonomy/term/".$terms->tid); $vacancycomma = ","; } } } return $result; }