private function parseQ ()
        {
            if (empty ($this->q) || $this->q == '*')
            {
                $this->displaySearchStr = CLUtil::getLabelForType ($this->type);
                $this->clVars['query'] = null;                
            }
            else
            {
                $tokens = StringUtil::tokenize ($this->q);
                $qParts = array ();
                
                foreach ($tokens as $token)
                {
                    if (preg_match ('/^(srchType|minAsk|maxAsk|hasPic|addTwo):(.*)/i', $token, $matches))
                    {
                        $this->clVars[strtolower ($matches[1])] = $matches[2];
                    }
                    else
                    {
                        $qParts[] = $token;
                    }
                }

                $this->displaySearchStr = implode (' ' , $qParts);
                $this->clVars['query'] = trim (preg_replace ('/ {2,}/', ' ', strtolower (implode (' ' , $qParts))));
            }
        }
 public function sitemap ()
 {
     $this->meta['h1'] = 'Craig\'s Little Buddy';
     $this->meta['h2'] = 'Wacha Lookin\' For?';           
     $this->meta['subLogoText'] = 'Site Map'; 
     $this->meta['title'] = 'Helping You Search Craigslist - Craig\'s Little Buddy';  
     $this->sections = CLUtil::getLabelForType ();
     asort ($this->sections);         
     $this->render ();                     
 }
		public function translate ()
		{
	        if ($this->path == '/')
	        {
	            $this->path = "/home";
	            return;
	        }
	        
	        // custom search URL's
	        $types = array_keys (CLUtil::getLabelForType ());
	        $str = implode('|', $types);
	        if (preg_match ("/^\/($str)(.*)/i", $this->path, $matches))
	        {
	            $this->path = "/search/{$matches[1]}{$matches[2]}";
	            return;
	        }
	        else if (preg_match ('/^\/search(.*)/i', $this->path, $matches))  // generic search
	        {
	            $this->path = "/search/all{$macthes[0]}";
	            return;
	        }
		}	
 public function render404 ()
 {        
 	header ('HTTP/1.0 404 Not Found');
 	
 	$data = array ('url' => $_SERVER['REQUEST_URI']);
 	$data['q'] = $_REQUEST['q'];
 	$data['searchOptions'] = CLUtil::getSearchOptions($_GET['type'], $_GET['q']);
 	
     $data['meta'] = array ('h1' => 'Page Not Found', 
             'h2' => 'This craigslist ad may have been removed.');
     
     $data['sections'] = CLUtil::getLabelForType ();
     asort ($data['sections']);
                 
     $t = new Duckk_Template ('status/404.php', $data);
     
     $t->setWrapper ('chrome.php');
     $t->render ();   
 }
	    protected function setupMeta ()
	    {
	        $numResults = number_format ($this->totalResults);
	        
	        $this->meta['subLogoText'] = ($this->searchType != 'search')
	                       ? CLUtil::getLabelForType ($this->searchType) . ' for sale'
	                       : TextUtil::getRandomPhrase ();
	        
	        $this->meta['h1'] = $this->searchOptions->displaySearchStr . (empty ($this->q) && $this->searchType != 'wtb' ? ' for sale on craigslist' : ''); 
            $this->meta['h2-addon'] = '<a id="showCityDialogLink2" href="javascript: void (null)">search more cities</a>';	                       
	        
	        if (! empty ($this->q))
	        {
    	        $this->meta['h2'] = $numResults 
    	                               . " search results for \"{$this->searchOptions->displaySearchStr}\" from " 
    	                               . count ($this->searchOptions->cities)
    	                               . ' craigslist cities';
	        }
	        else
	        {
                $this->meta['h2'] = $numResults 
                                       . " results in "
                                       . CLUtil::getLabelForType ($this->searchOptions->type) 
                                       . " from "
                                       . count ($this->searchOptions->cities)
                                       . ' craigslist cities';                                       	            
	        }
            
	        $this->meta['title'] = ($this->searchType != 'wtb')
	                           ? $this->searchOptions->displaySearchStr . ' for sale on craigslist'
	                           : 'WTB listings for ' . $this->searchOptions->displaySearchStr . ' on craigslist';
	        
            $this->meta['description'] = ($this->searchType != 'wtb')
                                ? "$numResults search results from " . count ($this->searchOptions->cities) . " craigslist cities."
                                : "$numResults WTB listings from  " . count ($this->searchOptions->cities) . ' craigslist cities.';

            $this->meta['description'] .= " Craig's Little Buddy helps you search craigslist. Search multiple cities, sort listings. Results updated constantly.";                                
	                               
            $this->meta['keywords'] = ($this->searchType != 'wtb')
                                ? $this->searchOptions->displaySearchStr . ', for sale, craigslist, classifieds, classified ad'
                                : $this->searchOptions->displaySearchStr . ', wtb, craigslist, classifieds, classified ads, want to buy';
                                
            if (empty ($this->q) && $this->searchOptions->type == 'search')
            {
                $this->meta['h2'] = $numResults . " search results from " . count ($this->searchOptions->cities) . ' craigslist cities';
                $this->meta['h1'] = 'For Sale on Craigslist';
                $this->meta['title'] = 'For Sale on Craigslist';
                $this->meta['description'] = 'Classified listings on craigslist.';
                $this->meta['keywords'] = 'search, for sale, craigslist, classifieds, classified ads';
            }
	    }
Exemplo n.º 6
0
<div id="nav">
    <div class="navLinks">
        <?
            $types = array_slice (CLUtil::getLabelForType (), 0, 11);
            
            if  ($searchType && ! array_search (CLUtil::getLabelForType ($searchType), $types))
            {
                //unset ($types['instruments']);
                $types[$searchType] = CLUtil::getLabelForType ($searchType); 
            }
            
            foreach ($types as $k => $v)
            {
                echo ($searchType != $k) ? "<a href=\"/$k\">$v</a>" :  "<span>$v</span>"; 
            } 
            
        ?>
        
        <a href="/home/sitemap">more &raquo;</a>
    </div>
    
    <!--
    <div class="userLinks">
        <a href="/" style="margin-left: 0px">Home</a>
        <a href="#">Sign Up</a>
        <a href="#">Login</a>                
    </div>
    -->
</div>
Exemplo n.º 7
0
                
                <? if ($searchType == 'search') : ?>
                    <? $cat = CLUtil::getCategoryFromUrl ($result['link']); ?>
                    <b>Category:</b> 
                    <a href="/<?php 
echo $cat;
?>
?q=<?php 
echo urlencode($searchOptions->q);
?>
&sort=<?php 
echo urlencode($sort);
?>
">
                        <?php 
echo CLUtil::getLabelForType($cat);
?>
</a>
                <? endif; ?>
            </div>
            
            <? if (! empty ($result['description'])) : ?>
                <div class="description" id="desc_<?php 
echo $i++;
?>
">
                    <? if (! empty ($result['clb']['images'])) : ?>
                        <div class="thumb" id="thumb_<?php 
echo $i;
?>
">
Exemplo n.º 8
0
?>
&q=<?php 
echo urlencode($searchOptions->q);
?>
">Search</a> &raquo;
                    <a target="_parent" href="/<?php 
echo $searchType;
?>
?sort=<?php 
echo $sort;
?>
&q=<?php 
echo urlencode($searchOptions->q);
?>
"><?php 
echo CLUtil::getLabelForType($searchType);
?>
</a> &raquo;             
                <? endif; ?>
                
                <a target="_parent" href="<?php 
echo $result['link'];
?>
">this ad</a>
            </span>              

            <div class="dude l">
                <a href="<?php 
echo $url;
?>
"><img src="/_/images/logo/littleDude.gif" /></a>