custom url with tokens for the tags plugin
This commit is contained in:
parent
5b5a4e7690
commit
bdd90a680d
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
bl-content/databases
|
|
||||||
bl-content/pages
|
|
||||||
bl-content/posts
|
|
||||||
bl-content/uploads
|
|
@ -6,8 +6,15 @@ class pluginTags extends Plugin {
|
|||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'label'=>'Tags',
|
'label'=>'Tags',
|
||||||
'sort'=>'date'
|
'sort'=>'date',
|
||||||
|
'link'=>''
|
||||||
);
|
);
|
||||||
|
$this->dbTokens = array(
|
||||||
|
"[postUrl]",
|
||||||
|
"[tagName]",
|
||||||
|
"[tagCount]"
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function form()
|
public function form()
|
||||||
@ -31,7 +38,14 @@ class pluginTags extends Plugin {
|
|||||||
$html .= '<option value="'.$key.'">'.$Language->get($value).'</option>';
|
$html .= '<option value="'.$key.'">'.$Language->get($value).'</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
|
$html .= '</div>';
|
||||||
|
|
||||||
|
$html .= '<div>';
|
||||||
|
$html .= '<label>'.$Language->get('Customize link').'</label>';
|
||||||
|
$html .= '<input name="link" id="jslink" type="text" value="'.$this->getDbField('link').'">';
|
||||||
|
$html .= '<pre>available tokens '. implode(', ', $this->dbTokens).' <br/>'.
|
||||||
|
htmlspecialchars('<a href="[token1]#content" >[token2] [token3]</a>').'</pre>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
@ -72,10 +86,25 @@ class pluginTags extends Plugin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach($tagArray as $tagKey=>$fields)
|
foreach($tagArray as $tagKey=>$fields)
|
||||||
{
|
{
|
||||||
// Print the parent
|
// Print the parent
|
||||||
$html .= '<li><a href="'.HTML_PATH_ROOT.$filter.'/'.$fields['tagKey'].'">'.$fields['name'].' ('.$fields['count'].')</a></li>';
|
$link='<a href="'.HTML_PATH_ROOT.$filter.'/'.$fields['tagKey'].'">'.$fields['name'].' ('.$fields['count'].')</a>';
|
||||||
|
if(!empty($this->getDbField('link'))){
|
||||||
|
$replacments=array(
|
||||||
|
"[postUrl]"=>HTML_PATH_ROOT.$filter.'/'.$fields['tagKey'], html_entity_decode($this->getDbField('link')),
|
||||||
|
"[tagName]"=>$fields['name'],
|
||||||
|
"[tagCount]"=>$fields['count']
|
||||||
|
);
|
||||||
|
$link= html_entity_decode($this->getDbField('link'));
|
||||||
|
foreach($this->dbTokens as $token){
|
||||||
|
$link= str_replace($token,$replacments[$token],$link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$html .= "<li>$link</li>";
|
||||||
}
|
}
|
||||||
$html .= '</ul>';
|
$html .= '</ul>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user