Example #1
0
 /**
  * 
  * @param string $tag Default is NULL
  * @param int $page Default is NULL
  * @return void
  */
 public function index($tag = NULL, $page = NULL)
 {
     $getData = array('query' => $tag ? $tag : Input::get('query'), 'type' => Input::get('type'), 'country' => Input::get('country'), 'make' => Input::get('make'), 'model' => Input::get('model'), 'year_min' => Input::get('year_min'), 'year_max' => Input::get('year_max'), 'price_min' => Input::get('price_min'), 'price_max' => Input::get('price_max'), 'currency' => Input::get('currency'), 'condition' => Input::get('condition'), 'color' => Input::get('color'), 'mileage_min' => Input::get('mileage_min'), 'mileage_max' => Input::get('mileage_max'), 'vehicle' => Input::get('vehicle'), 'vin' => Input::get('vin'), 'state' => Input::get('state'), 'city' => Input::get('city'), 'location' => Input::get('location'), 'order' => Input::get('order'), 'page' => $page ? $page : Input::get('page'));
     $getData = $this->mSearch->fixDashes($getData);
     $getData = $this->mSearch->fixLower($getData);
     $data = $this->mSearch->apiResults($getData);
     $data['params'] = $getData;
     $data['yearMin'] = $getData['year_min'] ? $getData['year_min'] : 1980;
     $data['yearMax'] = $getData['year_max'] ? $getData['year_max'] : (int) date('Y');
     $data['priceMin'] = $getData['price_min'] ? $getData['price_min'] : 0;
     $data['priceMax'] = $getData['price_max'] ? $getData['price_max'] : 50000;
     $data['mileageMin'] = $getData['mileage_min'] ? $getData['mileage_min'] : 0;
     $data['mileageMax'] = $getData['mileage_max'] ? $getData['mileage_max'] : 200000;
     $this->mSearch->saveTags($getData['query'], $data['total']);
     $data['latestTags'] = $this->mSearch->getTags('latest');
     $data['randomTags'] = $this->mSearch->getTags('random');
     if ($tag !== NULL) {
         Pagination::setQueryString(FALSE);
         Pagination::setURL(tagLink($getData['query']));
         $seoData = $this->mSearch->setSeo('tags', $getData, $data['total']);
         Layout::title(getSeo($seoData, 'tagsTitle'));
         Layout::desc(getSeo($seoData, 'tagsDesc'));
         Layout::heading(getSeo($seoData, 'tagsHeading'));
     } else {
         Pagination::setQueryString(TRUE);
         Pagination::setURL(searchLink($getData, FALSE));
         $seoData = $this->mSearch->setSeo('search', $getData, $data['total']);
         Layout::title(getSeo($seoData, 'searchTitle'));
         Layout::desc(getSeo($seoData, 'searchDesc'));
         Layout::heading(getSeo($seoData, 'searchHeading'));
     }
     Pagination::setTotal($data['total'], Config::get('searchResultsLimit', 'limit'), Config::get('searchPaginaLimit', 'limit'));
     Pagination::setCurrent($getData['page']);
     Pagination::setNumLinks(3);
     Pagination::run();
     $data['pagination'] = Pagination::getPagina();
     Layout::view('vSearch', $data);
 }
Example #2
0
            ?>
</a></li>
                                <?php 
        }
        ?>
                            <?php 
    }
    ?>
                            <?php 
    if ($randomTags) {
        ?>
                                <?php 
        foreach ($randomTags as $randomTag) {
            ?>
                                <li><a href="<?php 
            echo tagLink($randomTag->tag);
            ?>
" title="<?php 
            echo filterText($randomTag->tag);
            ?>
"><?php 
            echo filterText($randomTag->tag);
            ?>
</a></li>
                                <?php 
        }
        ?>
                            <?php 
    }
    ?>
                        </ul>
Example #3
0
/**
 * Print out the tag page for any given tag. Returns the output as HTML.
 *
 * @param string $tag
 * @return string
 */
function printTag($tag)
{
    global $Paths, $Cfg, $Current_weblog;
    $tag = normalizeTag($tag);
    if (!file_exists($Paths['pivot_path'] . "db/tagdata/" . $tag . ".tag")) {
        return "No such tag";
    }
    // If magic_quotes_gpc is set, we need to strip slashes..
    if (get_magic_quotes_gpc()) {
        $tag = stripslashes($tag);
    }
    if (file_exists($Paths['pivot_path'] . "db/tagdata/" . $tag . "-tagpage.cache")) {
        if (filectime($Paths['pivot_path'] . "db/tagdata/" . $tag . "-tagpage.cache") < time() - 60 * $Cfg['tag_cache_timeout']) {
            @unlink($Paths['pivot_path'] . "db/tagdata/" . $tag . "-tagpage.cache");
        } else {
            return "<!--CACHE HIT-->" . file_get_contents($Paths['pivot_path'] . "db/tagdata/" . $tag . "-tagpage.cache");
        }
    }
    if ($Cfg['tag_fetcher_enabled']) {
        $para_weblog = "?w=" . para_weblog($Current_weblog);
        $output = '
			<script type="text/javascript" src="' . $Paths['pivot_url'] . 'includes/js/jquery.js"></script>
			<script type="text/javascript">
			/*<![CDATA[ */
			function doList(type, tag)  {
				$("#tgrrsslist").html(\'<img src="' . $Paths['pivot_url'] . 'pics/taggerati/loading_\' + type + \'.gif" alt=""/>\');
				var url = "' . $Paths['pivot_url'] . 'includes/ajax_rsslist.php' . $para_weblog . '";
				$.get( url, { type: type, tag: tag }, function(output) { $("#tgrrsslist").html(output); } );
			}
			/* ]]> */
			</script>
		';
    }
    $output .= "<div id='tagpage'>\n<h2>" . lang('tags', 'tagoverview_header') . " '" . str_replace("+", " ", $tag) . "'</h2>\n\n";
    $output .= "<h3>" . lang('tags', 'entries_with_tag') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
    $output .= get_entries_with_tag($tag);
    $output .= "<h3>" . lang('tags', 'related_tags') . "</h3>\n\n";
    if (file_exists($Paths['pivot_path'] . "db/tagdata/" . $tag . ".rel")) {
        $fpTagFile = fopen($Paths['pivot_path'] . "db/tagdata/" . $tag . ".rel", "r");
        $sTagString = "";
        while (!feof($fpTagFile)) {
            $sTagString .= fread($fpTagFile, 4096);
        }
        fclose($fpTagFile);
        $aTagList = explode(",", $sTagString);
        $nCount = 0;
        foreach ($aTagList as $sThisTag) {
            $output .= "\n<a href=\"" . tagLink(str_replace(" ", "+", $sThisTag)) . "\" class=\"taglinkext\">{$sThisTag}</a>";
            $nCount++;
            if ($nCount < sizeof($aTagList)) {
                $output .= ", ";
            }
        }
    } else {
        $output .= "\n<p>" . lang('tags', 'no_related_tags') . "<p>\n";
    }
    if ($Cfg['tag_fetcher_enabled']) {
        $output .= "\n<div id='feedfetcher'>\n";
        $output .= "<h3>" . lang('tags', 'external_feeds') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
        $output .= "<p>\n" . lang('tags', 'click_icon') . " '" . str_replace("+", " ", $tag) . "'</p>\n<p id='tagbuttons'>\n";
        $sites = array('technorati' => 'Technorati', 'delicious' => 'Del.icio.us', 'furl' => 'Furl', 'magnolia' => 'Ma.gnolia', 'google' => 'Google', 'feedster' => 'Feedster', 'icerocket' => 'Icerocket', 'tagzania' => 'TagZania', 'shadows' => 'Shadows', 'feedmarker' => 'Feedmarker', '43things' => '43 Things');
        foreach ($sites as $key => $value) {
            $output .= sprintf("<a href=\"javascript:doList('%s','%s');\"><img src=\"%spics/taggerati/%s.png\" alt=\"%s\" /></a>\n", $key, str_replace('/', '', $_GET['tag']), $Paths['pivot_url'], $key, $value);
        }
        $output .= "</p>";
        $output .= "<div id=\"tgrrsslist\"></div>";
        $output .= "</div>\n";
    }
    if ($Cfg['tag_flickr_enabled']) {
        $output .= "<h3>" . lang('tags', 'flickr_images') . " '" . str_replace("+", " ", $tag) . "'</h3>\n\n";
        $output .= '

	<!-- Start of Flickr Badge -->
	<div id="flickrpics">
	<table><tr>
	<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&amp;count=' . $Cfg['tag_flickr_amount'] . '&amp;display=latest&amp;size=s&amp;layout=h&amp;source=all_tag&amp;tag=' . $tag . '"></script>
	</tr></table>
	</div>

	';
    }
    $output .= "</div>\n";
    $output .= "<!-- cached at: " . date("H:i", time()) . "-->";
    // Since it'll be built in, we don't want to display Marco's name on every page. Sorry Marco, you know we love you! ;-)
    // $output .= "<br/><br/><small>Taggerati extension for <a href=\"http://www.pivotlog.net/\">Pivot</a> by <a href=\"http://www.i-marco.nl/weblog/\">Marco van Hylckama Vlieg</a></small>";
    write_file($Paths['pivot_path'] . "db/tagdata/" . $tag . "-tagpage.cache", $output);
    return $output;
}
/**
 * Get detailed info for tags used in an entry
 *
 * @param string $template
 * @return string
 */
function snippet_ttaglist($template = '')
{
    global $PIVOTX;
    $aTagsList = getTags(false);
    if (sizeof($aTagsList) > 0) {
        $output = "<div id='tagpage'>\n";
        $output .= "<h3>" . __('Tags used in this posting') . "</h3>\n";
        $tagLinks = array();
        foreach ($aTagsList as $sTag) {
            makeRelatedTags($sTag, $aTagsList);
            $tagLinks[] = sprintf('<a rel="tag" href="%s" title="tag: %s">%s</a>', tagLink($sTag, $template), $sTag, $sTag);
        }
        $output .= "<p>" . implode(", ", $tagLinks) . "</p>\n";
        reset($aTagsList);
        foreach ($aTagsList as $sRelated) {
            $sTheRelatedLinks = getEntriesWithTag($sRelated, $PIVOTX['db']->entry["code"]);
            if (!strlen($sTheRelatedLinks) == 0) {
                $output .= "\n<h3>";
                $output .= __('Other entries about') . " '" . $sRelated . "'</h3>\n";
                $output .= $sTheRelatedLinks;
            }
        }
        $output .= "\n</div>\n";
    } else {
        $output = '';
    }
    return $output;
}
Example #5
0
 /**
  * 
  * @param string $make
  * @param string $model Default is NULL
  * @return string
  */
 function modelLink($make, $model = NULL)
 {
     return tagLink($make . ' ' . $model);
 }
Example #6
0
/**
 * Display a Tag, as used in the introduction or body
 *
 * @param string $tag
 * @param string $link
 * @param string $template
 * @return string
 */
function smarty_tt($params)
{
    $params = cleanParams($params);
    $tag = $params['tag'];
    $link = $params['link'];
    $template = getDefault($params['template'], '');
    $underscore = getDefault($params['underscore'], false);
    if (strlen($link) > 0) {
        // If the external link doesn't have a protocol prefix, add it.
        if (strpos($link, "tp://") === false) {
            $link = "http://" . $link;
        }
        $tag_url = $link;
        $title = __('Tagged external link');
    } else {
        $tag_url = tagLink($tag, $template);
        $title = __('Entries tagged with');
    }
    if (!empty($params['hrefonly'])) {
        $output = $tag_url;
    } else {
        if ($underscore != false) {
            $tag = str_replace("_", $underscore, $tag);
        }
        $output = sprintf("<a rel='tag' class='pivotx-taglink' href='%s' title='%s: %s'>%s</a>", $tag_url, $title, $tag, $tag);
    }
    return $output;
}
Example #7
0
/**
 * Get Tags that are related to a certain Tag
 *
 * @param string $tag
 * @return unknown
 */
function getRelatedTags($tag)
{
    global $PIVOTX, $paths;
    if ($PIVOTX['config']->get('db_model') == "flat") {
        // Getting related tags for flat files..
        $filename = urlencode($tag) . '.rel';
        if (file_exists($PIVOTX['paths']['db_path'] . "tagdata/{$filename}")) {
            $sTagString = file_get_contents($PIVOTX['paths']['db_path'] . "tagdata/{$filename}", "r");
            $taglist = explode(",", $sTagString);
        }
    } else {
        // Getting tags for SQL
        $tagtable = safeString($PIVOTX['config']->get('db_prefix') . "tags", true);
        // [JAN]
        // Set up DB factory
        $sqlFactory = new sqlFactory($PIVOTX['config']->get('db_model'), $PIVOTX['config']->get('db_databasename'), $PIVOTX['config']->get('db_hostname'), $PIVOTX['config']->get('db_username'), $PIVOTX['config']->get('db_password'));
        // Get a DB connection..
        $sql = $sqlFactory->getSqlInstance();
        //        $sql = new sql('mysql',
        //$PIVOTX['config']->get('db_databasename'),
        //                $PIVOTX['config']->get('db_hostname'),
        //                $PIVOTX['config']->get('db_username'),
        //                $PIVOTX['config']->get('db_password')
        //            );
        // [/JAN]
        // Getting related tags for MySQL db..
        $sql->query("SELECT DISTINCT(t2.tag)\n                    FROM {$tagtable} AS t1, {$tagtable} AS t2\n                    WHERE (t1.tag=" . $sql->quote($tag) . " AND t1.target_uid=t2.target_uid AND t2.tag!=" . $sql->quote($tag) . ")\n                    ORDER BY t2.tag ASC");
        $rows = $sql->fetch_all_rows();
        $taglist = makeValuepairs($rows, '', 'tag');
    }
    if (is_array($taglist)) {
        $output = array();
        foreach ($taglist as $thistag) {
            $output[] = "<a href=\"" . tagLink(str_replace(" ", "+", $thistag)) . "\" class=\"taglinkext\">{$thistag}</a>";
        }
        $output = implode(", \n", $output);
    } else {
        $output .= "\n<p>" . __('No related tags') . "</p>\n";
    }
    return $output;
}
/**
 * Display a Tag, as used in the introduction or body
 *
 * @param string $tagName
 * @param string $externalLink
 * @param string $template
 * @return string
 */
function snippet_tt($tagName, $externalLink = "", $template = "")
{
    if (strlen($externalLink) > 0) {
        // If the external link doesn't have a protocol prefix, add it.
        if (strpos($externalLink, "tp://") === false) {
            $externalLink = "http://" . $externalLink;
        }
        $tag_url = $externalLink;
    } else {
        $tag_url = tagLink($tagName, $template);
    }
    return '<a rel="tag" class="taglink" href="' . $tag_url . '" title="' . lang('tags', 'tag_ext_link') . ": {$tagName}\">{$tagName}</a>";
}