summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Herman Haugholt <huyderman@users.sourceforge.net>2008-07-16 11:10:11 +0000
committerJo-Herman Haugholt <huyderman@users.sourceforge.net>2008-07-16 11:10:11 +0000
commit6e37e897703eafa08956178b116ccf2a8130852e (patch)
treee653cbb9ea89b79c1f218395f49d0288dce1a779
parent824d8d44fb6cb44ad7c20cdafcf44b5ea129e579 (diff)
downloadtags-6e37e897703eafa08956178b116ccf2a8130852e.tar.gz
tags-6e37e897703eafa08956178b116ccf2a8130852e.tar.bz2
tags-6e37e897703eafa08956178b116ccf2a8130852e.zip
Added PrettyPrint support to Tags
-rw-r--r--.htaccess11
-rwxr-xr-xLibertyTag.php21
-rw-r--r--modules/mod_tags_cloud.tpl2
-rw-r--r--templates/tags_cloud.tpl2
-rw-r--r--templates/tags_list.tpl2
-rw-r--r--templates/view_tags_mini_inc.tpl2
6 files changed, 34 insertions, 6 deletions
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..d1c9cae
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,11 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+# Uncomment this if mod_rewrites are not working for you. some hosting services have cranky mod_rewrite
+# RewriteBase /tags/
+ RewriteCond %{SCRIPT_FILENAME} -f [OR]
+ RewriteCond %{SCRIPT_FILENAME}/index.php -f
+ RewriteRule ^(.*)$ - [L]
+
+ RewriteRule ^view/(.*)$ index.php?tags=$1 [L]
+ RewriteRule ^(.*)$ index.php?tags=$1 [L,QSA]
+</IfModule> \ No newline at end of file
diff --git a/LibertyTag.php b/LibertyTag.php
index b594171..1b89579 100755
--- a/LibertyTag.php
+++ b/LibertyTag.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_tags/LibertyTag.php,v 1.37 2008/06/15 15:08:48 wjames5 Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_tags/LibertyTag.php,v 1.38 2008/07/16 11:10:10 huyderman Exp $
* @package tags
*
* @copyright Copyright (c) 2004-2006, bitweaver.org
@@ -59,6 +59,9 @@ class LibertyTag extends LibertyBase {
if ($result) {
$ret = array();
while ($res = $result->fetchRow()) {
+ //Add tag urls
+ $res['tag_url'] = LibertyTag::getDisplayUrl($res['tag']);
+
$ret[] = $res;
}
$this->mInfo['tags'] = $ret;
@@ -67,7 +70,6 @@ class LibertyTag extends LibertyBase {
return( count( $this->mInfo ) );
}
-
function loadTag ( &$pParamHash ){
if( !empty( $pParamHash['tag_id'] ) && is_numeric( $pParamHash['tag_id'] )) {
$selectSql = ''; $joinSql = ''; $whereSql = '';
@@ -82,6 +84,9 @@ class LibertyTag extends LibertyBase {
$whereSql";
if ( $result = $this->mDb->getRow( $query, $bindVars ) ){
+ //Add tag url
+ $result['tag_url'] = LibertyTag::getDisplayUrl($result['tag']);
+
$this->mInfo = $result;
};
}
@@ -373,6 +378,17 @@ class LibertyTag extends LibertyBase {
$this->mDb->CompleteTrans();
}
}
+
+ function getDisplayUrl($tag){
+ global $gBitSystem;
+ if( $gBitSystem->isFeatureActive( 'pretty_urls' ) || $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ) {
+ $rewrite_tag = $gBitSystem->isFeatureActive( 'pretty_urls_extended' ) ? 'view/':'';
+ $tag_url = TAGS_PKG_URL.$rewrite_tag.urlencode( $tag );
+ } else {
+ $tag_url = TAGS_PKG_URL.'index.php?tags='.urlencode( $tag );
+ }
+ return $tag_url;
+ }
/**
* This function gets a list of tags
@@ -451,6 +467,7 @@ class LibertyTag extends LibertyBase {
while ($res = $result->fetchRow()) {
// this was really sucky, its now replaced by the slightly lesssucky subselect above. the subselect should prolly be replaced with a count table
// $res['popcant'] = $this->getPopCount($res['tag_id']);
+ $res['tag_url'] = LibertyTag::getDisplayUrl($res['tag']);
$ret[] = $res;
}
diff --git a/modules/mod_tags_cloud.tpl b/modules/mod_tags_cloud.tpl
index dc52a48..06ccf24 100644
--- a/modules/mod_tags_cloud.tpl
+++ b/modules/mod_tags_cloud.tpl
@@ -5,7 +5,7 @@
{if $modTagData}
{foreach item=tag from=$modTagData}
<li class="tag{$tag.tagscale}">
- <a href="{$smarty.const.TAGS_PKG_URL}index.php?tags={$tag.tag|escape:"url"}">{$tag.tag}</a>
+ <a href="{$tag.tag_url}">{$tag.tag}</a>
</li>
{/foreach}
{else}
diff --git a/templates/tags_cloud.tpl b/templates/tags_cloud.tpl
index 2c89732..df3b4b0 100644
--- a/templates/tags_cloud.tpl
+++ b/templates/tags_cloud.tpl
@@ -3,7 +3,7 @@
<ul id="cloud">
{foreach item=tag from=$tagData}
<li class="tag{$tag.tagscale}">
- <a href="{$smarty.const.TAGS_PKG_URL}index.php?tags={$tag.tag|escape:"url"}">{$tag.tag}</a>&nbsp;<small>({$tag.popcant})</small>
+ <a href="{$tag.tag_url}">{$tag.tag}</a>&nbsp;<small>({$tag.popcant})</small>
</li>
{/foreach}
</ul>
diff --git a/templates/tags_list.tpl b/templates/tags_list.tpl
index 6ad9b6a..c4ffbe1 100644
--- a/templates/tags_list.tpl
+++ b/templates/tags_list.tpl
@@ -10,7 +10,7 @@
{foreach item=tag from=$tagData}
<tr class="{cycle}">
<td>
- <strong><a href="{$smarty.const.TAGS_PKG_URL}index.php?tags={$tag.tag}">{$tag.tag}</a></strong>
+ <strong><a href="{$tag.tag_url}">{$tag.tag}</a></strong>
</td>
<td style="text-align:center;">
{$tag.popcant}
diff --git a/templates/view_tags_mini_inc.tpl b/templates/view_tags_mini_inc.tpl
index d23c003..5026041 100644
--- a/templates/view_tags_mini_inc.tpl
+++ b/templates/view_tags_mini_inc.tpl
@@ -6,7 +6,7 @@
<strong>{tr}Tags:{/tr}</strong>&nbsp;
{section name=tag loop=$tagData}
{if $smarty.section.tag.index > 0},&nbsp;{/if}
- <a href="{$smarty.const.TAGS_PKG_URL}index.php?tags={$tagData[tag].tag}">{$tagData[tag].tag}</a>
+ <a href="{$tagData[tag].tag_url}">{$tagData[tag].tag}</a>
{if $gContent->isOwner() || $gBitUser->hasPermission('p_tags_admin')}
<input type="checkbox" name="tag_id[]" value="{$tagData[tag].tag_id}" />
<input type="hidden" name="tag_{$tagData[tag].tag_id}" value="{$tagData[tag].tag}" />