<?php
/**
* sh404SEF support for the com_jsjobs component (v 1.0.4.2) available at joomshark.com
* Author: Josh Rosenthal
* contact: IGetWork.com
*
* This extension will give the SEF advance style URLs to the JS Jobs component.
* Place this file (com_jsjobs.php) in the /components/com_sh404sef/sef_ext directory
*
* Copyright (C) 2009 Josh Rosenthal, IGetWork.com , All rights reserved.
* Use freely, but please give a link to IGetWork.com
* or add the following code in to your template once
* <img src=\" IGetWork.com/tracking/IGetWork%20track.gif alt=\"IGetWork - get paid to list and find work\" width=\"1\" height=\"1\" lang=\"en\" xml:lang=\"en\">
*/
defined( \'_JEXEC\' ) or die( \'Direct Access to this location is not allowed.\' );
//
standard plugin initialize function - don\'t change
global $sh_LANG, $sefConfig;
$shLangName = \'\';
$shLangIso = \'\';
$title = array();
$shItemidString = \'\';
$dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option);
if ($dosef == false) return;
//
standard plugin initialize function - don\'t change
// Handle argument: Itemid
if (eregi(\'Itemid=[0-9]+\', $string) === false) { // if no Itemid in non-sef URL
//global $Itemid;
if ($sefConfig->shInsertGlobalItemidIfNone && !empty($shCurrentItemid)) {
$string .= \'&Itemid=\'.$shCurrentItemid; // append current Itemid
$Itemid = $shCurrentItemid;
shAddToGETVarsList(\'Itemid\', $Itemid); // V 1.2.4.m
}
if ($sefConfig->shInsertTitleIfNoItemid)
$title[] = $sefConfig->shDefaultMenuItemName ?
$sefConfig->shDefaultMenuItemName : getMenuTitle($option, null, $shCurrentItemid );
$shItemidString = $sefConfig->shAlwaysInsertItemid ?
_COM_SEF_SH_ALWAYS_INSERT_ITEMID_PREFIX.$sefConfig->replacement.$shCurrentItemid
: \'\';
} else { // if Itemid in non-sef URL
$shItemidString = $sefConfig->shAlwaysInsertItemid ?
_COM_SEF_SH_ALWAYS_INSERT_ITEMID_PREFIX.$sefConfig->replacement.$Itemid
: \'\';
}
if (!empty($Itemid)){
shRemoveFromGETVarsList(\'Itemid\');
}
//base directory for this application
$title[] = \'work\';
/* handle random variables */
// VARIABLE: view
if (isset($view)){
$view = @$view;
shRemoveFromGETVarsList(\'view\');
} else {
$view = null;
}
if (!empty($view)){
shRemoveFromGETVarsList(\'view\');
}
// VARIABLE: c
if (isset($c)){
$c = @$c;
shRemoveFromGETVarsList(\'c\');
} else {
$c = null;
}
// VARIABLE: jobcat
if (isset($jobcat)){
$jobcat = @$jobcat;
//TODO:recode js_jobs to allow URL category/$cn.html and shRemoveFromGETVarsList(\'jobcat\');
} else {
$jobcat = null;
}
// VARIABLE: cn
if (isset($cn)){
$cn = @$cn;
shRemoveFromGETVarsList(\'cn\');
} else {
$cn = null;
}
// VARIABLE: vj
if (isset($vj)){
$vj = @$vj;
shRemoveFromGETVarsList(\'vj\');
} else {
$vj = null;
}
// VARIABLE: jobid
if (isset($jobid)){
$jobid = @$jobid;
} else {
$jobid = null;
}
// VARIABLE: layout
if (isset($layout)){
//TODO: internationalize manually-added $title[] elements
$layout = @$layout;
if($layout == \'listjobs\'){
$title[] = \'category\';
$temptitle=getMenuTitle($option, (isset($task) ? @$task : null), $Itemid, null, $shLangName );
if($temptitle=\"/\"){
// make page title the categories/[js_job_categories.cat_title].html
$sql = \"SELECT cat_title FROM #__js_job_categories WHERE id = \".$jobcat;
$database->setQuery($sql);
if (isset($shLanguage) && shIsMultilingual()) {
$rows = @$database->loadObjectList( \'\', true, $shLanguage);
} else {
$rows = @$database->loadObjectList( );
}
if ($database->getErrorNum()) {
//TODO: determine if this if is even necessary
// die( $database->stderr() );
} elseif(@count($rows) > 0) {
if (!shIsHomepage( $shLink )) { // V1.2.4.q homepage detection
if(!empty($rows[0]->cat_title)) {
$temptitle = $rows[0]->cat_title;
}
}
}
}
$title[] = $temptitle;
} elseif($layout == \'viewjob\') {
$title[] = \"view job\";
} elseif($layout == \'jobapply\') {
$title[] = \"apply for job\";
} elseif($layout == \'formjob\') {
//TODO: figure out how to use the menu title when posting a new job and \"edit job\" when appropriate
$title[] = \"edit job\";
} elseif($layout == \'empview\') {
//TODO: figure out how to use the menu title when posting a new job and \"my resume\" when appropriate
$title[] = \"my resume\";
} else {
// make page title the /page-title.html
$title[] = getMenuTitle($option, (isset($task) ? @$task : null), $Itemid, null, $shLangName );
}
} else {
$layout = null;
// make page title the /page-title.html
$title[] = getMenuTitle($option, (isset($task) ? @$task : null), $Itemid, null, $shLangName );
}
shRemoveFromGETVarsList(\'layout\');
shRemoveFromGETVarsList(\'option\');
shRemoveFromGETVarsList(\'lang\');
//
standard plugin finalize function - don\'t change
if ($dosef){
$string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,
(isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null),
(isset($shLangName) ? @$shLangName : null));
}
//
standard plugin finalize function - don\'t change
?>